csvファイルのデータから、あるカラムのデータの二次微分を求めてグラフ化したいのですが、そのやり方が分かりません。
file = glob.glob("F:/*.csv") data_list=[] for all_file in file: data=pd.read_csv(all_file) data_list.append(data) #データのソート df = pd.concat(data_list, sort=False, axis=1) WaveLength=df.iloc[:,[0]] Ref=df.drop("Wavelength",axis=1) Analy_data=pd.concat([WaveLength, Ref],axis=1) print(Analy_data) x_col = Analy_data.columns[0] y_col = Analy_data.columns[1] dx=np.gradient(x_col) dy=np.gradient(y_col) plt.plot(x,dy/dx)
TypeError Traceback (most recent call last) <ipython-input-24-2d0e96d36f9d> in <module> ----> 1 plt.plot(x,dy/dx) TypeError: unsupported operand type(s) for /: 'list' and 'list'
ファイルの中身はこのようになっていて、xがWavelengthの列、とりあえずyをCastanopsis.spの列というような感じで、微分したものをグラフにしたいのですがエラーが起きてしまいます。
リスト型というのがダメっぽいというのは分かるのですが、微分可能な形式に、どのように変換すればいいかが分かりません。
python自体初心者なのでよくわからず、詳細に教えていただければ幸いです。
宜しくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/19 04:17
2020/01/19 06:05