0.预处理
import pandas as pd
import numpy as npexcel = pd.read_excel('附件1.xlsx', 'Data', index_col=None, na_values=['NA'])excel.columnsIndex(['eventid', 'iyear', 'imonth', 'iday', 'approxdate', 'extended',
'resolution', 'country', 'country_txt', 'region',
...
'addnotes', 'scite1', 'scite2', 'scite3', 'dbsource', 'INT_LOG',
'INT_IDEO', 'INT_MISC', 'INT_ANY', 'related'],
dtype='object', length=135)pd.DataFrame(excel[['eventid','nkill','nwound','property','propextent','propvalue','targtype1','targtype2','targtype3','country','region','resolution','iyear','imonth','iday']]).dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
eventid
nkill
nwound
property
propextent
propvalue
targtype1
targtype2
targtype3
country
region
resolution
iyear
imonth
iday
0
199801010001
104.0
6.0
-9
NaN
NaN
4
NaN
NaN
34
11
NaT
1998
1
1
1
199801010002
0.0
3.0
0
NaN
NaN
19
NaN
NaN
167
9
NaT
1998
1
1
2
199801010003
1.0
0.0
0
NaN
NaN
14
NaN
NaN
603
8
NaT
1998
1
1
3
199801020001
0.0
0.0
1
3.0
NaN
7
NaN
NaN
95
10
NaT
1998
1
2
4
199801020002
0.0
1.0
0
NaN
NaN
14
NaN
NaN
155
10
NaT
1998
1
2
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
114178
201712310022
1.0
2.0
-9
NaN
NaN
4
NaN
NaN
182
11
NaT
2017
12
31
114179
201712310029
2.0
7.0
1
4.0
-99.0
4
NaN
NaN
200
10
NaT
2017
12
31
114180
201712310030
0.0
0.0
1
4.0
-99.0
14
NaN
NaN
160
5
NaT
2017
12
31
114181
201712310031
0.0
0.0
-9
NaN
NaN
2
NaN
NaN
92
6
NaT
2017
12
31
114182
201712310032
0.0
0.0
0
NaN
NaN
20
NaN
NaN
160
5
NaT
2017
12
31
114183 rows × 15 columns
最后更新于
这有帮助吗?