def createElementDiv(name):
element = document.createElement('div')
element.id = name
document.body.append(element)
return Element(name)
import pandas as pd
from pyodide.http import open_url
# 판다스에서 csv 를 데이터 프레임으로 읽어옴
df = pd.read_csv(open_url("http://dreamplan7.cafe24.com/pyscript/csv/avocado.csv"))
df.insert(2, 'month', df['Date'].str[:7], True)
createElementDiv('output1').write(df)
# 월별 매출량 조사
df_group = df.fillna(0).groupby('month')[['Total Volume']].sum().sort_values(by='month', ascending=True)
createElementDiv('output1').write(df_group)