I was trying to obtain a formatted list of dates pandas date_range and obtained an extra null string. This is using pandas v2.2.2.
>>> import pandas as pd
>>> pd.date_range('2000-01-01','2000-01-03').format('%Y-%m-%d')
<stdin>:1: FutureWarning: DatetimeIndex.format is deprecated and will be removed in a future version. Convert using index.astype(str) or index.map(formatter) instead.
['', '2000-01-01', '2000-01-02', '2000-01-03']
I found that this avoids the null string.
>>> list(pd.date_range('2000-01-01','2000-01-03').strftime('%Y-%m-%d').
astype(str))
['2000-01-01', '2000-01-02', '2000-01-03']
Remark: I used generative AI to help find the solution but this post itself was not created using generative AI.