やりたいことは、画像の通りです。
※要素1の左側は”カテゴリ”です
以下プログラムを書きました。
python
1# -*- coding: utf-8 -*- 2import numpy as numpy 3import pandas as pd 4import matplotlib.pyplot as plt 5import matplotlib as mpl 6 7 8#read csv 9aiueo_df = pd.read_csv("../test.csv",encoding="SHIFT-JIS") 10 11 12aiueo_list = list(set(aiueo_df["カテゴリ"])) 13print(aiueo_list) 14for i in range(len(aiueo_list)): 15 aiueo_list_t = aiueo_df.loc[aiueo_list[i]] 16 aiueo_list_t.to_csv(aiueo_list[i]+".csv",encoding="SHIFT-JIS") 17print("Finish!")
以下エラーが起きました。
result
1KeyError: 'the label [縺輔@縺吶○縺拆 is not in the [index]'
文字コードの問題だとは思うのですが、どのようにすればよろしいでしょうか。
どうぞよろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/09 07:27