Parsing Week Of Year To Datetime Objects With Pandas
A B C D yearweek 0 245 95 60 30 2014-48 1 245 15 70 25 2014-49 2 150 275 385 175 2014-50 3 100 260 170 335 2014-51 4 580 925 535 25
Solution 1:
You need another parameter for specify day - check this:
df = pd.to_datetime(df.yearweek.add('-0'), format='%Y-%W-%w')
print (df)
0 2014-12-07
1 2014-12-14
2 2014-12-21
3 2014-12-28
4 2015-01-18
5 2015-01-25
6 2015-02-01
7 2015-02-08
Name: yearweek, dtype: datetime64[ns]
Post a Comment for "Parsing Week Of Year To Datetime Objects With Pandas"