0
日付を見つけることができる別の列に基づいて月を示す新しい列を作成したいと思います。日付を月 - 年に変換する新しい列パンダPython
私は次のコードを作成しました:
BusinessObjects_na_['Customer Handover Date'] = pd.to_datetime(BusinessObjects_na_['Customer Handover Date'])
BusinessObjects_na_['Month'] = BusinessObjects_na_['Customer Handover Date'].apply(lambda x: str(x).strftime('%B-%Y'))
をしかし、Pythonは次のエラーを与える:
AttributeError: 'str' object has no attribute 'strftime'
誰かがこの1で私を助けることができますか?あなたはパンダの最新バージョンを実行している場合
キャストを 'str'に削除しようとしましたか? 'lambda x:x.strftime( '%B-%Y')' – Ben