diff --git a/README.md b/README.md index 1a7b981..50bed57 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ lat = -33.75 lon = 151.25 # Create temporary dataframe at specific location -df1 = df.loc[lat, lon] +df1 = df.loc[(lat, lon), :] # Plot time series fig, ax = plt.subplots(1, 1, figsize=(6, 4)) @@ -112,14 +112,11 @@ dates = df.index.get_level_values('time').unique() fig, ax = plt.subplots(3, 4) for i, date in enumerate(dates): - # Get temporary dataframe with only one date - df1 = df[df.index.get_level_values('time') == date] - - # Remove date from multi-index - df1.index = df1.index.droplevel(-1) + # Get temporary dataframe with only one date ('slice(None)' is ':') + df1 = df.loc[(slice(None), slice(None), date), :] # Split multi-index so that rows=latitude and columns=longitude - grid = df1.unstack() + grid = df1.unstack().unstack() # Plot colour map for current month a = ax.ravel()[i]