【发布时间】:2020-02-11 23:00:54
【问题描述】:
大家好,我需要您的帮助才能在 pandas 数据框中获得预期的输出/结果。我有一个文件,其中包含如下所示的数据:
Time/Location Value
Location1
Today 3
Next day 0
Weekend -6
Next week 1
Location2
Today 2
Next day -1
Weekend 3
Next week 2
Location3
Today 1
Next day 3
Weekend 1
Next week -1
Location4
Today 3
Next day 2
Weekend 5
Next week 4
Location5
Today 4
Next day 2
Weekend 3
Next week 1
Location6
Today -1
Next day 3
Weekend 3
Next week 2
并期望输出如下所示,它正在为“位置”创建新列。
Location Time Value
Location1 Today 3
Location1 Next day 0
Location1 Weekend -6
Location1 Next week 1
Location2 Today 2
Location2 Next day -1
Location2 Weekend 3
Location2 Next week 2
Location3 Today 1
Location3 Next day 3
Location3 Weekend 1
Location3 Next week -1
Location4 Today 3
Location4 Next day 2
Location4 Weekend 5
Location4 Next week 4
Location5 Today 4
Location5 Next day 2
Location5 Weekend 3
Location5 Next week 1
Location6 Today -1
Location6 Next day 3
Location6 Weekend 3
Location6 Next week 2
感谢任何帮助/建议....拜托!
谢谢!
【问题讨论】:
-
发布数据,而不是图片。以此为指导:stackoverflow.com/questions/20109391/…
-
到底是什么问题? Stack Overflow 不是免费的代码编写服务。请参阅:How to Ask、tour、help center。
标签: python python-3.x pandas numpy dataframe