-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
DatetimeDatetime data dtypeDatetime data dtypeEnhancementIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_stringStringsString extension data type and string dataString extension data type and string data
Milestone
Description
I think Series.dt.strftime()
might be useful
This is essentially just calling .format()
on a datetimelike lindex (which handles NaT
and such)
In [1]: dates = pd.to_datetime(pd.Series(['20010101', '20010331']), format = '%Y%m%d')
In [2]: dates
Out[2]:
0 2001-01-01
1 2001-03-31
dtype: datetime64[ns]
In [4]: pd.DatetimeIndex(dates.values).format()
Out[4]: ['2001-01-01', '2001-03-31']
In [5]: pd.DatetimeIndex(dates.values).format(date_format='%Y%m%d')
Out[5]: ['20010101', '20010331']
Metadata
Metadata
Assignees
Labels
DatetimeDatetime data dtypeDatetime data dtypeEnhancementIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_stringStringsString extension data type and string dataString extension data type and string data