Reputation: 1
Newbie here ...
I obtained this dataframe using the groupby
function. My aim is to plot the table in a way that will show the nested plots with the ph
index as the pivot. Any other wiser methods (especially using matplotlib
or seaborn
) are also welcome.
df_ph = df2.groupby('pH').agg(['min','max','mean'])
{('Temperature (°C)', 'min'): {6.83: 22.5,
6.89: 23.6,
6.9: 22.5,
6.92: 21.4,
6.94: 23.2},
('Temperature (°C)', 'max'): {6.83: 22.5,
6.89: 23.6,
6.9: 22.5,
6.92: 21.7,
6.94: 23.2},
('Temperature (°C)', 'mean'): {6.83: 22.5,
6.89: 23.6,
6.9: 22.5,
6.92: 21.549999999999997,
6.94: 23.2},
('Turbidity (NTU)', 'min'): {6.83: 3.3,
6.89: 4.6,
6.9: 4.2,
6.92: 4.7,
6.94: 4.0},
('Turbidity (NTU)', 'max'): {6.83: 3.3,
6.89: 4.6,
6.9: 4.2,
6.92: 4.9,
6.94: 4.0},
('Turbidity (NTU)', 'mean'): {6.83: 3.3,
6.89: 4.6,
6.9: 4.2,
6.92: 4.800000000000001,
6.94: 4.0},
('Dissolved Oxygen (mg/L)', 'min'): {6.83: 6.1,
6.89: 7.2,
6.9: 6.0,
6.92: 6.3,
6.94: 6.6},
('Dissolved Oxygen (mg/L)', 'max'): {6.83: 6.1,
6.89: 7.2,
6.9: 6.0,
6.92: 6.8,
6.94: 6.6},
('Dissolved Oxygen (mg/L)', 'mean'): {6.83: 6.1,
6.89: 7.2,
6.9: 6.0,
6.92: 6.55,
6.94: 6.6},
('Conductivity (µS/cm)', 'min'): {6.83: 348,
6.89: 320,
6.9: 357,
6.92: 362,
6.94: 348},
('Conductivity (µS/cm)', 'max'): {6.83: 348,
6.89: 320,
6.9: 357,
6.92: 363,
6.94: 348},
('Conductivity (µS/cm)', 'mean'): {6.83: 348.0,
6.89: 320.0,
6.9: 357.0,
6.92: 362.5,
6.94: 348.0}}
I tried using
df.plot(xticks=df2['pH'], ylabel='pH')
but didn't get any reasonable plotting outcome.
Upvotes: 0
Views: 48