Last active
October 7, 2015 06:18
-
-
Save robinfang/24c7cb18c41c91f52b8c to your computer and use it in GitHub Desktop.
转换时间序列
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import sys | |
| if __name__ == "__main__": | |
| print sys.argv[0] | |
| print sys.argv[1] | |
| # print sys.argv[2] | |
| if not len(sys.argv)==2: | |
| print "usage: python t2s.py" | |
| sys.exit() | |
| f = open(sys.argv[1]) | |
| tl = f.readlines() | |
| tl = map(str.strip,tl) | |
| ts = pd.Series(tl) | |
| ts = pd.to_datetime(ts) | |
| df = pd.DataFrame(data=1,index=ts,columns=['A']) | |
| result = df.resample("D",how="sum") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment