pdpatch adds methods to pandas’ DataFrame and Series for a faster data science pipeline. It also defines drop-in replacements for seaborn and plotly.express that automatically label axes with nicer titles. We use nbdev to build this project.
pip install pdpatch
frompdpatch.allimport*importpandasaspdfrompdpatch.expressimport*df=pd.DataFrame({'time__s__': range(10), 'position__m__': [i**1.3foriinrange(10)], 'speed__m/s__': 10*[1]}) #df = pd.DataFrame({'time__s__': range(10), 'position__m__': range(10)})px.scatter(df, x='time__s__', y='position__m__').show('png')frompdpatch.seabornimportsnssns.scatterplot(data=df, x='time__s__', y='position__m__');fig=px.scatter(df,x='time__s__', y='time__s__') |px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__']) fig.show('png')fig=px.scatter(df,x='time__s__', y='time__s__') /px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__']) fig.show('png')fig=px.scatter(df,x='time__s__', y='time__s__') |px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__']) (fig/fig).show('png')df.rename(columns={'col_1': 'new_name'})->df.renamec('col_1', 'new_name')
df=dummydf() df.renamec('col_1', 'new_name').to_html()| new_name | col_2 | |
|---|---|---|
| 0 | 100 | a |
| 1 | 101 | b |
| 2 | 102 | c |
| 3 | 103 | d |
| 4 | 104 | e |
df.len()5 df.col_1.minmax(100, 104) df=dummydf() df.to_html()| col_1 | col_2 | |
|---|---|---|
| 0 | 100 | a |
| 1 | 101 | b |
| 2 | 102 | c |
| 3 | 103 | d |
| 4 | 104 | e |





