我有一个数据框,该数据框返回在一个时间范围内完成的销售计数,该计数存储到变量total_sale_count
total_sale_count_old = pd.DataFrame(total_sale_count, columns=['TotalSaleCount'])
total_stop_count = total_sale_count_old.set_index('TotalSaleCount').T.rename_axis('Total Sales').rename_axis(None, 1).reset_index()
以上抛出错误
TypeError: rename_axis() takes from 1 to 2 positional arguments but 3 were given
答案 0 :(得分:0)
我相信您需要:
total_sale_count = pd.Series([1,2,3], index=list('abc'))
total_stop_count = pd.DataFrame([total_sale_count], index=['TotalSaleCount'])
print (total_stop_count)
a b c
TotalSaleCount 1 2 3