我有一个带有两列的df,一列包含表示唯一字符的#,另一列包含日期时间值。我想将“date-time”值传递给一个单独的df,其中包含多个相同字符的条目
这就是df的样子。第二个df应该在最右边有“Timestamp”列,在复制和粘贴之后显示为diff
char timestamp
0 2 12/03/08 10:41:47
1 7 01/15/08 21:47:09
2 9 01/01/08 11:02:20
3 10 07/06/08 17:04:02
4 19 01/07/08 03:01:19
char level race charclass zone guild timestamp
10114236 2 18 Orc Shaman The Barrens 6 12/03/08 10:41:47
622587 7 54 Orc Hunter Feralas -1 01/15/08 21:47:09
623200 7 54 Orc Hunter Un'Goro Crater -1 01/15/08 21:56:54
623826 7 54 Orc Hunter The Barrens -1 01/15/08 22:07:23
624439 7 54 Orc Hunter Badlands -1 01/15/08 22:17:08
df = pd.read_csv('\dataframes\wowah_data.csv')
df = df.sort_values(['char', ' timestamp'])
activationday = df.groupby('char')[' timestamp'].min().reset_index()
df['firstday'] = pd.concat(activationday[' timestamp'])
print(df.head())
我得到以下错误
TypeError: first argument must be an iterable of pandas objects, you passed an object of type "Series"
目前没有回答
相关问题 更多 >
编程相关推荐