我正在尝试创建一个列,以便只从Trade Trade Dt列中检索月份统计数据。
我希望下面的MMM格式是一个数字。
map_cat['Trade Month'] = pd.DatetimeIndex(map_cat['Trade Trade Dt']).month发布于 2020-02-24 15:04:41
在%b中使用strftime
map_cat['Trade Month'] = pd.DatetimeIndex(map_cat['Trde Trade Dt']).strftime('%b')发布于 2020-02-24 15:05:25
另一种选择:
map_cat['Trade Month'] = pd.DatetimeIndex(map_cat['Trde Trade Dt']).month_name().str[:3]https://stackoverflow.com/questions/60378587
复制相似问题