I'm trying to to convert yyyy-mm-dd
into yyyy-ww
.
How is this achieved for the following dataframe:
dates = {'date': ['2015-02-04','2016-03-05']}
df = pd.DataFrame(dates, columns=['date'])
print(df)
0 2015-02-04
1 2016-03-05
dtype: datetime64[ns]
I've tried using
YW = pd.to_datetime(df, format='%Y%W')
However without luck.
I'm trying to to convert yyyy-mm-dd
into yyyy-ww
.
How is this achieved for the following dataframe:
dates = {'date': ['2015-02-04','2016-03-05']}
df = pd.DataFrame(dates, columns=['date'])
print(df)
0 2015-02-04
1 2016-03-05
dtype: datetime64[ns]
I've tried using
YW = pd.to_datetime(df, format='%Y%W')
However without luck.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.