我有一个数据帧df2
:
extention just_dates
0 d875679ds1.htm 2003-01-02
1 d875679ds1.htm 2015-10-31
2 form_s1a.htm 2015-11-01
3 form_s1a.htm 2015-11-01
4 form_s1a.htm 2015-11-01
5 form_s1a.htm 2015-11-01
6 d698362ds1a.htm 2015-11-01
7 d698362ds1a.htm 2015-11-01
8 form_s1a.htm 2015-11-01
9 form_s1a.htm 2015-11-01
10 form_s1a.htm 2015-11-01
11 d698362ds1a.htm 2015-11-01
12 form_s1a.htm 2015-11-01
13 form_s1a.htm 2015-11-01
14 form_s1a.htm 2015-11-01
15 d804420ds1a.htm 2015-11-01
16 d923792ds1a.htm 2015-11-02
17 d923792ds1a.htm 2015-11-02
18 d923792ds1a.htm 2015-11-02
19 a2221572zs-1.htm 2015-11-02
20 d938556df1.htm 2015-11-02
21 d938556df1.htm 2015-11-02
22 d938556df1.htm 2015-11-02
23 d938556df1.htm 2015-11-02
24 d766811ds1.htm 2015-11-02
25 d44564d8k.htm 2015-11-02
26 d776249ds1a.htm 2015-11-02
27 d776249ds1a.htm 2015-11-02
28 d776249ds1a.htm 2015-11-02
29 d776249ds1a.htm 2015-11-02
30 d776249ds1a.htm 2015-11-02
31 d776249ds1a.htm 2015-11-02
32 d776249ds1a.htm 2015-11-02
33 d776249ds1a.htm 2015-11-03
34 d776249ds1a.htm 2015-11-03
35 d776249ds1a.htm 2015-11-03
36 d938481ds1a.htm 2015-11-03
37 d766811ds1.htm 2015-11-03
38 d938481ds1a.htm 2015-11-03
39 d938481ds1a.htm 2015-11-03
40 d938481ds1a.htm 2015-11-03
41 d938481ds1a.htm 2015-11-03
42 d938481ds1a.htm 2015-11-03
43 d766811ds1.htm 2015-11-03
44 d946612ds1.htm 2015-11-04
45 forms-1a.htm 2015-11-04
46 forms-1a.htm 2015-11-04
用命令
out=[]
out.append(df2['just_dates'].value_counts().sort_index())
我变成
2003-01-02 1
2015-10-31 1
2015-11-01 14
2015-11-02 17
2015-11-03 11
2015-11-04 3
这正是我想要的。它统计数据帧df2
中每天的条目数。但我的问题是我想要一个新的数据帧out
,我认为out
不是一个数据帧,对吧?我想这是因为我没有标题和行号。怎样才能成为一个新的数据帧out
?你知道吗
您的输出是
pd.series
,您可以使用to_frame()
将其转换为df例如:
输出:
那么
输出:
相关问题 更多 >
编程相关推荐