a=[]
b=[]for each inrange(len(df.loc[:,'Date'])):
a.append(2000+int(df.loc[:,'Date'][each].split('-')[0]))for each inrange(len(df.loc[:,'Date'])):
b.append(df.loc[:,'Date'][each].split('-')[1])
df['year']=a
df['month']=b
column = df.columns.tolist()
column.remove('Date')
a = column.pop()
column.insert(0,a)
b = column.pop()
column.insert(0,b)
column
['year',
'month',
'Total number of license issued',
'lowest price ',
'avg price',
'Total number of applicants',
'rate']
df.loc[:,column]
year
month
Total number of license issued
lowest price
avg price
Total number of applicants
rate
0
2002
Jan
1400
13600
14735
3718
0.376547
1
2002
Feb
1800
13100
14057
4590
0.392157
2
2002
Mar
2000
14300
14662
5190
0.385356
3
2002
Apr
2300
16000
16334
4806
0.478568
4
2002
May
2350
17800
18357
4665
0.503751
...
...
...
...
...
...
...
...
198
2018
Aug
10402
88300
88365
192755
0.053965
199
2018
Sep
12712
87300
87410
189142
0.067209
200
2018
Oct
10728
88000
88070
181861
0.058990
201
2018
Nov
11766
87300
87374
177355
0.066342
202
2018
Dec
12850
87400
87508
165442
0.077671
203 rows × 7 columns
(2) 按年统计拍卖最低价的下列统计量:最大值、均值、 0.75 分位数,要求显示在同一张表上。
import pandas as pd
import numpy as np
df = pd.read_csv('data/数据集/2002年-2018年上海机动车拍照拍卖.csv')
df = pd.concat([df['Date'].str.split('-',expand=True),df],axis=1)