-1
我有以下代碼:轉換大熊貓時間戳月endate
#!/usr/bin/python
import pandas as pd
df = pd.read_excel(io='http://www.iea.org/gtf/download/Export_GTF_IEA.xls', sheetname='Data', skip_footer=5,)
df = df.drop('Unnamed: 2', axis=1)
df = df.drop('Exit', axis=1)
df = df.drop('Entry', axis=1)
df = df.drop('MAXFLOW (Mm3/h)', axis=1)
df = df.T
df.to_csv('foo.csv', encoding='utf-8', sep='\t', header=False)
#
輸出的樣本是這樣的:
print df
0 1 2 3 4 \
Borderpoint Adriatic LNG Almeria Alveringem Alveringem Badajoz
2008-10-01 00:00:00 0 0 0 0 152.81
2008-11-01 00:00:00 0 0 0 0 183.31
2008-12-01 00:00:00 0 0 0 0 85.21
2009-01-01 00:00:00 0 0 0 0 199.16
2009-02-01 00:00:00 0 0 0 0 104.48
2009-03-01 00:00:00 0 0 0 0 9.17
如何時間戳轉換爲一個月-結束日期?
在您的示例輸出中,「Borderpoint」列日期是每個月的第一個日期(而不是最後一個)。你要哪個? – cmaher