We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2021年到2023年可能Pandas版本几经变更, 导致DataFrame的聚合操作 出现Keyerror : CustomerID, 我调整了一下Code的顺序 data1=data0.assign(amount=data0['UnitPrice'].multiply(data0['Quantity'])) first_time=data1[['CustomerID','InvoiceDate']].groupby('CustomerID').nth(0).reset_index().rename(columns={'InvoiceDate':'first_time'}) first_time['first_time'] = first_time['first_time'].apply(lambda x: x.date()) data2=pd.merge(data1,first_time,how='left',on=['CustomerID']) 应该是可以正常运行了 另外Chapter 3 还有多处 Load Data 指定的数据文件路径一会儿在 Data 子文件夹里, 一会儿又是同级文件夹, 看得人头发晕😂
data1=data0.assign(amount=data0['UnitPrice'].multiply(data0['Quantity'])) first_time=data1[['CustomerID','InvoiceDate']].groupby('CustomerID').nth(0).reset_index().rename(columns={'InvoiceDate':'first_time'}) first_time['first_time'] = first_time['first_time'].apply(lambda x: x.date()) data2=pd.merge(data1,first_time,how='left',on=['CustomerID'])
The text was updated successfully, but these errors were encountered:
数据文件路径这点已经反馈给作者。这是行业里面数据科学家缺乏软件开发背景的一个问题,在代码的复用性上和严谨性上关注不够。
Sorry, something went wrong.
No branches or pull requests
2021年到2023年可能Pandas版本几经变更, 导致DataFrame的聚合操作 出现Keyerror : CustomerID, 我调整了一下Code的顺序
data1=data0.assign(amount=data0['UnitPrice'].multiply(data0['Quantity'])) first_time=data1[['CustomerID','InvoiceDate']].groupby('CustomerID').nth(0).reset_index().rename(columns={'InvoiceDate':'first_time'}) first_time['first_time'] = first_time['first_time'].apply(lambda x: x.date()) data2=pd.merge(data1,first_time,how='left',on=['CustomerID'])
应该是可以正常运行了
另外Chapter 3 还有多处 Load Data 指定的数据文件路径一会儿在 Data 子文件夹里, 一会儿又是同级文件夹, 看得人头发晕😂
The text was updated successfully, but these errors were encountered: