Skip to content

Commit 7a35035

Browse files
committed
s
1 parent 27a1e1a commit 7a35035

9 files changed

+2361
-2
lines changed

.obsidian/workspace.json

+25-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@
1818
"source": false
1919
}
2020
}
21+
},
22+
{
23+
"id": "54099c09bdc4d863",
24+
"type": "leaf",
25+
"state": {
26+
"type": "release-notes",
27+
"state": {
28+
"currentVersion": "1.4.12"
29+
}
30+
}
2131
}
22-
]
32+
],
33+
"currentTab": 1
2334
}
2435
],
2536
"direction": "vertical"
@@ -128,6 +139,16 @@
128139
"file": "docs/markdown/markdown-table.md"
129140
}
130141
}
142+
},
143+
{
144+
"id": "31b3d8c6091786f5",
145+
"type": "leaf",
146+
"state": {
147+
"type": "all-properties",
148+
"state": {
149+
"sortOrder": "frequency"
150+
}
151+
}
131152
}
132153
]
133154
}
@@ -146,8 +167,10 @@
146167
"command-palette:Open command palette": false
147168
}
148169
},
149-
"active": "22c5a678e83a2154",
170+
"active": "54099c09bdc4d863",
150171
"lastOpenFiles": [
172+
"docs/qgis/geoserver.md",
173+
"docs/datavisualize/pandas.md",
151174
"docs/markdown/markdown-table.md",
152175
"README.md",
153176
"docs/datavisualize/data-visualize-framework.md",

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@
9797
* [Python数据可视化](./docs/datavisualize/python.md)
9898
* [Dash](./docs/datavisualize/dash.md)
9999
* [数据可视化框架比较](./docs/datavisualize/data-visualize-framework.md)
100+
* [Pandas](./docs/datavisualize/pandas.md)
101+
102+
## GIS
103+
* [qgis](./docs/qgis/qgis.md)
104+
105+
## 机器学习
106+
* [机器学习十大算法](./docs/ml/ml.md)
107+
108+
## ESP8266
109+
* [深入理解Arduino下的ESP8266_Non-OS_SDK API⑥ Sniffer(混杂模式) 相关接口](./docs/esp8266/esp8266-wifi-sniffer.md)
110+
* [深入理解Arduino下的ESP8266_Non-OS_SDK API⑤ Wi-Fi接口](./docs/esp8266/esp8266-wifi.md)
111+
* [深入理解Arduino下的ESP8266_Non-OS_SDK API⑤ Wi-Fi接口.pdf](./docs/esp8266/深入理解Arduino下的ESP8266_Non-OS_SDK%20API⑤%20Wi-Fi接口_51CTO博客_arduino+esp8266.pdf)
100112

101113
## 各类awesome
102114

docs/datavisualize/pandas.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Pandas
2+
3+
## 导入Excel
4+
5+
```
6+
pd.read_excel(io,sheet_name,header)
7+
```
8+
9+
常用参数说明:
10+
11+
* io:表示,xs或 xsx文件路径或类文件对象
12+
* sheet_name: 表示工作表,取值如下表所示
13+
* header默认值为0,取第一工行的值为列名,数据为除列名以外的数据,如果数据不包含列名,则设置header=None
14+
15+
|| 说明 |
16+
| --- | --- |
17+
| sheet_name=0 | 第一个Sheet页中的数据作为DataFrame对象 |
18+
| sheet_name=1 | 第二个Sheet页中的数据作为DataFrame对象 |
19+
| sheet_name='Sheet1' | 名称为'Sheet1'的Sheet页中的数据作为DataFrame对象 |
20+
| sheet_name =[0, 1, 'Sheet3'] | 第一个、第二个和名称为Sheet3的Sheet页中的数据作为DataFrame对象 |
21+
| sheet_name=None | 读取所有工作表 |
22+
23+
```
24+
import pandas as pd
25+
26+
pd.set_option('display.unicode.east_asian_width', True) # 自适应合适的宽度
27+
df = pd.read_excel('./data/daily_work_report_q3.xlsx', sheet_name='Sheet1', usecols=[1]) # 导入一列数据
28+
print(df)
29+
df = pd.read_excel('./data/daily_work_report_q3.xlsx', sheet_name='Sheet1', usecols=['姓名', '总成绩']) # 导入多列数据
30+
print(df)
31+
df = pd.read_excel('./data/daily_work_report_q3.xlsx', 0, 3) # 导入第一个Sheet,将第4行作为列名
32+
```
33+
34+
## 导入CSV文件
35+
36+
```
37+
pd.read_csv(filepath_or_buffer, sep=',', header, encoding=None)
38+
```
39+
40+
常用参数说明
41+
42+
* filepath_or_buffer:字符串、文件路径,也可以是URL链接
43+
* sep:字符串、分隔符
44+
* header:指定作为列名的行,默认值为0,即取第一行的值为列名。数据为除列名以外的数据,若数据不包含列表,则设置header=None
45+
* encoding:宇符串,默认值为None,文件的编码格式
46+
47+
## 导入txt文件
48+
49+
```
50+
pd.read_csv(filepath_or_buffer,sep='\t', header,encoding=None)
51+
```
52+
53+
## 导入HTML网页
54+
55+
只能导入网页中含有table标签的数据
56+
57+
```
58+
pd.read_html(io, match='.+', flavor,header,encoding)
59+
```
60+
61+
参数说明:
62+
63+
* io:字符串、文件路径,可以是URL链接,网址不接受https
64+
* match:正则表达式
65+
* flavor:解释器默认为'lxml'
66+
* header:指定列栐題所在的行
67+
* encoding: 文件的編砢格式
68+
69+
示例代码:
70+
71+
```
72+
# 导入HTML
73+
import pandas as pd
74+
url = 'http://www.espn.com/nba/salaries/_/year/2023/seasontype/4'
75+
df = pd.DataFrame() # 创建一个空的DataFrame对象
76+
# DataFrame添加数据
77+
df = df.append(pd.read_html(url, header=0))
78+
print(df)
79+
# 保存成csv文件
80+
df.to_csv('nbasalary.csv', index=False) # index=False设置不保存默认的索引
81+
```
82+
83+
## 数据抽取
84+
85+
DataFrame対象的loc属性与iloc属性
86+
87+
* loc属性
88+
以列名(columns)和行名(index)作力参数. 当只有一个参数时,默认是行名,即抽取整行数据,包括所有列。
89+
* iloc属性
90+
以行和列位置索引(即:0,1,2,...) 作参数,0表示第一行,1表示第2行,以此类推。当只有一个参数时,默认是行索引,即抽取整行数据,包括所有列。
91+
92+
示例代码:
93+
94+
```
95+
import pandas as pd
96+
pd.set_option('display.unicode.east_asian_width', True)
97+
data = [[46, 29, 29], [50, 100, 78], [63, 87, 93]]
98+
index = ['章三', '李四', '王五']
99+
columns = ['数学', '语文', '外语']
100+
df = pd.DataFrame(data=data, index=index, columns=columns)
101+
print(df)
102+
print('--------------------------------')
103+
# 提取行数据
104+
print(df.loc['章三']) # 使用行索引名称
105+
print(df.loc[['章三', '王五']])
106+
print('--------------------------------')
107+
print(df.iloc[[0, 2]])
108+
print('--------------------------------')
109+
print(df.loc['章三':'王五']) # 使用切片,从章三到王五,包含王五
110+
111+
print(df.iloc[0:2]) # 使用行索引序号的时候包含开头不包含结尾,不包含王五
112+
print('--------------------------------')
113+
# iloc[start:end:step]
114+
print(df.iloc[1::]) # 从1开始到最后一个,步长为1
115+
print(df.iloc[::2]) # 从0开始到最后一个,步长为2
116+
117+
```
118+

docs/esp8266/esp8266-wifi-sniffer.md

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# 深入理解Arduino下的ESP8266_Non-OS_SDK API⑥ Sniffer(混杂模式) 相关接口
2+
3+
## 文章目录
4+
```
5+
1. Sniffer 相关接口
6+
1.1 混杂模式
7+
2.相关API
8+
2.1 wifi_promiscuous_enable —— 开启混杂模式 (sniffer)
9+
2.2 wifi_promiscuous_set_mac —— 设置 sniffer 模式时的 MAC 地址过滤,可过滤出发给指定 MAC 地址的包(也包含广播包)
10+
2.3 wifi_set_promiscuous_rx_cb —— 注册混杂模式下的接收数据回调函数,每收到一包数据,都会进入注册的回调函数
11+
2.4 wifi_get_channel —— 获取信道号
12+
2.5 wifi_set_channel —— 设置信道号,用于混杂模式
13+
```
14+
15+
16+
1. Sniffer 相关接口
17+
18+
Sniffer 接口位于 tools/sdk/include/user_interface.h
19+
20+
1.1 混杂模式
21+
22+
混杂模式(英语:promiscuous mode)是电脑网络中的术语。是指一台机器的网卡能够接收所有经过它的数据流,而不论其目的地址是否是它。
23+
混杂模式就是接收所有经过网卡的数据包,包括不是发给本机的包。默认情况下网卡只把发给本机的包(包括广播包)传递给上层程序,其它的包一律丢弃。简单的讲,混杂模式就是指网卡能接受所有通过它的数据流,不管是什么格式,什么地址的。事实上,计算机收到数据包后,由网络层进行判断,确定是递交上层(传输层),还是丢弃,还是递交下层(数据链路层、MAC子层)转发。
24+
简单的说,网卡的混杂模式是为网络分析而提供的。(wifi杀手探测器也是基于这个原理 ESP8266开发之旅 应用篇⑥ 检测周边WiFi杀手)
25+
26+
2. 相关API
27+
28+
2.1 wifi_promiscuous_enable —— 开启混杂模式 (sniffer)
29+
30+
函数定义
31+
```
32+
void wifi_promiscuous_enable(uint8 promiscuous)
33+
```
34+
35+
参数
36+
37+
```
38+
uint8 promiscuous
39+
• 0:关闭混杂模式
40+
• 1:开启混杂模式
41+
```
42+
43+
返回值
44+
45+
```
46+
⽆无
47+
```
48+
49+
注意
50+
51+
```
52+
• 仅支持在 ESP8266 单 Station 模式下,开启混杂模式
53+
54+
• 混杂模式中,ESP8266 Station 和 SoftAP 接口均失效
55+
56+
• 若开启混杂模式,请先调用 wifi_station_disconnect 确保没有连接
57+
58+
• 混杂模式中请勿调用其他 API,请先调用 wifi_promiscuous_enable(0) 退出 sniffer
59+
```
60+
61+
2.2 wifi_promiscuous_set_mac —— 设置 sniffer 模式时的 MAC 地址过滤,可过滤出发给指定 MAC 地址的包(也包含广播包)
62+
63+
函数定义
64+
65+
```
66+
void wifi_promiscuous_set_mac(const uint8_t *address)
67+
```
68+
69+
参数
70+
71+
```
72+
const uint8_t *address:MAC 地址
73+
```
74+
75+
返回值
76+
77+
```
78+
⽆无
79+
```
80+
81+
注意
82+
83+
```
84+
• 本接口需在 wifi_promiscuous_enable(1) 使能混杂模式后调用;
85+
86+
• MAC 地址过滤仅对当前这次的 sniffer 有效;
87+
88+
• 如果停止 sniffer,又再次 sniffer,需要重新设置 MAC 地址过滤。
89+
```
90+
91+
示例
92+
93+
```
94+
char ap_mac[6] = {0x16, 0x34, 0x56, 0x78, 0x90, 0xab};
95+
wifi_promiscuous_set_mac(ap_mac);
96+
```
97+
98+
2.3 wifi_set_promiscuous_rx_cb —— 注册混杂模式下的接收数据回调函数,每收到一包数据,都会进入注册的回调函数
99+
100+
函数定义
101+
102+
```
103+
void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb)
104+
```
105+
106+
参数
107+
108+
```
109+
wifi_promiscuous_cb_t cb:回调函数
110+
```
111+
112+
返回值
113+
114+
```
115+
116+
```
117+
118+
2.4 wifi_get_channel —— 获取信道号
119+
120+
函数定义
121+
122+
```
123+
uint8 wifi_get_channel(void)
124+
```
125+
126+
参数
127+
128+
```
129+
130+
```
131+
132+
返回值
133+
134+
```
135+
信道号
136+
```
137+
138+
2.5 wifi_set_channel —— 设置信道号,用于混杂模式
139+
140+
函数定义
141+
142+
```
143+
bool wifi_set_channel (uint8 channel)
144+
```
145+
146+
参数
147+
148+
```
149+
uint8 channel:信道号
150+
```
151+
152+
返回值
153+
```
154+
true:成功
155+
false:失败
156+
```

0 commit comments

Comments
 (0)