<jupyter_start><jupyter_text>QGridInteractive pandas dataframes: https://github.com/quantopian/qgrid```pip install qgrid --upgrade```<jupyter_code>df2 = df[df['Mine_State'] != "Wyoming"].groupby('Mine_State').sum()
df3 = df.groupby('Mine_State').sum()
# have to run this from the home dir of this repo
# cd insight/
# python setup.py develop
%aimport insight.plotting
insight.plotting.plot_prod_vs_hours(df3, color_index=1)
# insight.plotting.plot_prod_vs_hours(df2, color_index=1)
def plot_prod_vs_hours(
    df, color_index=0, output_file="../img/production-vs-hours-worked.png"
):
    fig, ax = plt.subplots(figsize=(10, 8))
    sns.regplot(
        df["Labor_Hours"],
        df["Production_short_tons"],
        ax=ax,
        color=sns.color_palette()[color_index],
    )
    ax.set_xlabel("Labor Hours Worked")
    ax.set_ylabel("Total Amount Produced")
    x = ax.set_xlim(-9506023.213266129, 204993853.21326613)
    y = ax.set_ylim(-51476801.43653282, 746280580.4034251)
    fig.tight_layout()
    fig.savefig(output_file)
plot_prod_vs_hours(df2, color_index=0)
plot_prod_vs_hours(df3, color_index=1)
# make a change via qgrid
df3 = qgrid_widget.get_changed_df()<jupyter_output><empty_output><jupyter_text>Github https://github.com/jbwhit/jupyter-tips-and-tricks/commit/d3f2c0cef4dfd28eb3b9077595f14597a3022b1c?short_path=04303fcdiff-04303fce5e9bb38bcee25d12d9def22e<jupyter_code>qgrid_widget = qgrid.show_grid(
    df2[["Year", "Labor_Hours", "Production_short_tons"]],
    show_toolbar=True,
)
qgrid_widget<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup