

「Excel×Python 自動化の超基本」という本で勉強しています。

[code]

    import pandas as pd
    import matplotlib as plt
    from sklearn.linear_model import LinearRegression
    def readTempData(fileName):
        df=pd.read_csv(fileName,encoding="Shift_JIS",skiprows=6)
        df.columns=["日付","気温","品質情報","均質番号"]
        df['日付']=pd.to_datetime(df['日付'])
        df["曜日"]=df["日付"].dt.dayofweek
        df["月"]=df["日付"].df.month
        df["日"]=df["日付"].df.day
        return df
    def readSalesData(filenName):
        df=pd.read_excel(fileName)
        df['日付']=pd.to_datetime(df['日付'])
        return df
    
    dfTemp=readTempData("気象データ2017.csv")
    
    dfsShop=readSalesData("洋菓子店売上リスト2017.xlsx")
    
    df=dfTemp.copy()
    df=df.merge(dfShop,how="inner",on="日付")
    x=df[["月","日","曜日","気温"]]
    y=df["売上金額"]
    print(x)
    print(y)
    
    model=LinearRegression()
    model.flt(x,y)
    print(model.coef_)
    print(moedl.intercept_)
    print(model.pridict(x))
    print(model.score(x,y))
    
[/code]


CC BY-SA 4.0
2021-04-27T06:09:15.337
75530
2021-04-27T07:54:25.723
2021-04-27T07:54:25.723
3060
44718
question
python
CVcodeのターミナルの横の問題という項目のエラーが消えません