我正在尝试重组excel表(或csv),以便日期不再是列标题.我正在使用有限的python知识来尝试这样做,但由于不知道从哪里开始,我可以使用一些帮助.
在每个日期下记录当天发生的特定地点的情况.可以跳过空值.某些单元格包含" - "并且可以转换为0.我想为日期创建一列,并使用一列来表示当天的数字读数.如果当天监控地名,则地名是新行.
示例(以这种方式启动的人的smh):
Name,7/1/2009,7/2/2009,7/3/2009,7/4/2009..... (and so on to the present)
Place A,,5,3,
Place B,0,,23,--
Place C,1,2,,35
Run Code Online (Sandbox Code Playgroud)
我想要的是:
Name, Date, Reading
Place A, 7/2/2009, 5
Place A, 7/3/2009, 3
Place B, 7/1/2009, 0
Place B, 7/4/2009, 0 <--- Even though this is a dash originally it can be converted to a 0 to keep the number an int.
Run Code Online (Sandbox Code Playgroud)
有数百个行(地点),列(日期)已经达到BPD(这是正确的1772列!).