#pyhon
機械学習のN-beatsをpythonのpycharm)実行しようとして、以下のエラーが出てしまいました。
Traceback (most recent call last):
File "C:/Users/takaa/PycharmProjects/pythonProject4/N-beats3.py", line 242, in <module>
dict_city_weather = {city:df_city for city,df_city in dfw1_city}
File "C:/Users/takaa/PycharmProjects/pythonProject4/N-beats3.py", line 242, in <dictcomp>
dict_city_weather = {city:df_city for city,df_city in dfw1_city}
ValueError: too many values to unpack (expected 2)
以下のリンクを参考にしています.
print("count of duplicates before treatment:",dfw1.duplicated(subset=["dt_iso", "city_name"], keep="first").sum()) dfw1 = dfw1.drop_duplicates(subset=["dt_iso", "city_name"], keep="first") dfw1.reset_index() print("count of duplicates after treatment:",dfw1.duplicated(subset=["dt_iso", "city_name"], keep="first").sum()) # set datetime index dfw1["time"] = pd.to_datetime(dfw1["dt_iso"], utc=True, infer_datetime_format=True) dfw1.set_index("time", inplace=True) dfw1.drop("dt_iso", inplace=True, axis=1) print("size of energy dataframe:", df1.shape[0]) dfw1_city = dfw1.groupby("city_name").count() print("dfw1\city",dfw1_city) # separate the cities: a weather dataframe for each of them np.set_printoptions(threshold=np.inf) print(dfw1_city) dict_city_weather = {city:df_city for city,df_city in dfw1_city} #dfw1の要素が1から順番に抽出
dfw1_cityは以下のような配列になっています
temp temp_min temp_max ... rain_1h snow_3h clouds_all
city_name ...
Barcelona 35064 35064 35064 ... 35064 35064 35064
Bilbao 35064 35064 35064 ... 35064 35064 35064
Madrid 35064 35064 35064 ... 35064 35064 35064
Seville 35064 35064 35064 ... 35064 35064 35064
Valencia 35064 35064 35064 ... 35064 35064 35064
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/06/28 08:49