Skip to content

Commit e25a116

Browse files
committed
Fix modelchain_example notebook
1 parent 9d0ec08 commit e25a116

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

example/modelchain_example.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,17 @@
121121
" kwargs['datapath'] = os.path.join(os.path.split(\n",
122122
" os.path.dirname(__file__))[0], 'example')\n",
123123
" file = os.path.join(kwargs['datapath'], filename)\n",
124-
" # read csv file \n",
124+
" # read csv file\n",
125125
" weather_df = pd.read_csv(\n",
126126
" file, index_col=0, header=[0, 1],\n",
127127
" date_parser=lambda idx: pd.to_datetime(idx, utc=True))\n",
128128
" # change type of index to datetime and set time zone\n",
129129
" weather_df.index = pd.to_datetime(weather_df.index).tz_convert(\n",
130130
" 'Europe/Berlin')\n",
131131
" # change type of height from str to int by resetting columns\n",
132-
" weather_df.columns = [weather_df.axes[1].levels[0][\n",
133-
" weather_df.axes[1].codes[0]],\n",
134-
" weather_df.axes[1].levels[1][\n",
135-
" weather_df.axes[1].codes[1]].astype(int)]\n",
132+
" l0 = [_[0] for _ in weather_df.columns]\n",
133+
" l1 = [int(_[1]) for _ in weather_df.columns]\n",
134+
" weather_df.columns = [l0, l1]\n",
136135
" return weather_df\n",
137136
"\n",
138137
"\n",

0 commit comments

Comments
 (0)