我正试图把这个csv读成大熊猫
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:58:57.973614']"
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:58:59.237387']"
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:59:00.346325']"
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,只有2列,第二列是列表,当使用带有参数的pd.read_csv()时,有没有办法正确解释它(意味着将列表中的值读取为列)?
谢谢
我有一个数据框df:
A B
0 28 abc
1 29 def
2 30 hij
3 31 hij
4 32 abc
5 28 abc
6 28 abc
7 29 def
8 30 hij
9 28 abc
10 29 klm
11 30 nop
12 28 abc
13 29 xyz
df.dtypes
A object # A is a string column as well
B object
dtype: object
Run Code Online (Sandbox Code Playgroud)
我想将此列表中的值用于 groupby:
i = np.array([ 3, 5, 6, 9, 12, 14])
Run Code Online (Sandbox Code Playgroud)
基本上,df索引为 0、1、2 的所有行都在第一组中,索引为 3、4 的行在第二组中,索引为 …