前提・実現したいこと
ビッグデータをPythonのピボットテーブルで
分析したいと思っています。
そこで性別と年代に関するテーブルを作ろうとした時に
以下のエラーが起きました。
発生している問題・エラーメッセージ
KeyError: 'sex'
該当のソースコード
Python
1d1.pivot_table(['sex', 'age_latest_cat'])
試したこと
Keyとして確かにあるか確認するため、
print(d1.keys())を使って確認したところ、
Index(['cst_id,date_entry_c,date_entry_n,yymm_entry,Store_code,KaiinType,KaiinStatus,Gold_Kaiin,DMFlag_c,MailFlag_c,birthday_c,birthday_n,age_latest,age_latest_cat,age_latest_cat_2,sex,PostNo,Addr1,Main_StoreName,Main_St_SalesChannel,Main_St_Region,Main_St_Hierarchy'], dtype='object')
というように確かに存在しました。
何卒よろしくお願い申し上げます。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/12 04:42
2019/07/12 04:43
2019/07/12 04:47
2019/07/12 04:48
2019/07/12 05:14