pandasでピボットテーブル

プログラム

import pandas as pd
df = pd.read_csv ('ticker.csv')
pivot_table = df.pivot (index='tick', columns='Date', values='Adj Close')
print(pivot_table)
pivot_table.to_csv('pivot_table.csv')
Date,Close,Adj Close,tick
133,742,2023-11-27
133,770,2023-12-04
133,762,2023-12-11
160,2045,2023-11-27
160,1871,2023-12-04
160,1864,2023-12-11
tick,2023-11-27,2023-12-04,2023-12-11
133,742,770,762,762,
160,2045,1871,1864,

Python

Posted by eightban