def test_two_column_index(self, params, dataframe, caplog): gdf = dataframe[columns[:2] + ['firing_rate']].groupby( columns[:2]).sum() if 'hue' in params: plot_grouped_dataframe(gdf, metrics='firing_rate', **params) assert hue_ignored_warning in caplog.text else: plot_grouped_dataframe(gdf, metrics='firing_rate', **params)
import matplotlib.pyplot as plt import seaborn as sns from gdfplot.core import plot_grouped_dataframe dots = sns.load_dataset('dots') dots = dots.loc[(dots['time'] >= 0) & (dots['time'] <= 50)] g2 = dots[['align', 'choice', 'firing_rate']].groupby(['align', 'choice']).sum() plot_grouped_dataframe(g2, metrics='firing_rate', hue='align', h_subplots='choice') plt.show()
def test_one_column_index(self, params, dataframe): gdf = dataframe[columns[:1] + ['firing_rate']].groupby( columns[:1]).sum() plot_grouped_dataframe(gdf, metrics='firing_rate', **params)
def test_two_column_index(self, params, dataframe): gdf = dataframe[columns[:2] + ['firing_rate']].groupby( columns[:2]).sum() with pytest.raises(ColumnNameNotInIndex): plot_grouped_dataframe(gdf, metrics='firing_rate', **params)
def test_three_column_index(self, params, dataframe, caplog): gdf = dataframe[columns + ['firing_rate']].groupby(columns).sum() plot_grouped_dataframe(gdf, metrics='firing_rate', **params) assert hue_ignored_warning in caplog.text