pdpatch


Namepdpatch JSON
Version 0.1.9 PyPI version JSON
download
home_pagehttps://github.com/asappinc/pdpatch/tree/main/
SummaryNew methods for pandas DataFrame and Series.
upload_time2023-03-27 19:54:54
maintainer
docs_urlNone
authorAndres Babino
requires_python>=3.6
licenseMIT License
keywords pandas patch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pdpatch
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

`pdpatch` adds methods to [pandas](https://pandas.pydata.org/)’
`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](https://nbdev.fast.ai/) to build this project.

## Install

`pip install pdpatch`

## How to use

``` python
from pdpatch.all import *
```

### Interactive Method `.less()`

![Alt Text](less15_360.gif)

### Automatically Rename snake_case columns in `plotly.express` and `seaborn`

``` python
import pandas as pd
from pdpatch.express import *
df = pd.DataFrame({'time__s__': range(10), 'position__m__': [i**1.3 for i in range(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')
```

![](index_files/figure-gfm/cell-3-output-1.png)

``` python
from pdpatch.seaborn import sns
sns.scatterplot(data=df, x='time__s__', y='position__m__');
```

![](index_files/figure-gfm/cell-4-output-1.png)

### Add Altair-like Operation to plotly Figures

``` python
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')
```

![](index_files/figure-gfm/cell-5-output-1.png)

``` python
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')
```

![](index_files/figure-gfm/cell-6-output-1.png)

``` python
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')
```

![](index_files/figure-gfm/cell-7-output-1.png)

### Shorter methods

`df.rename(columns={'col_1': 'new_name'})`-\>`df.renamec('col_1', 'new_name')`

``` python
df = dummydf()
df.renamec('col_1', 'new_name').to_html()
```

<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>
</th>
<th>
new_name
</th>
<th>
col_2
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
0
</th>
<td>
100
</td>
<td>
a
</td>
</tr>
<tr>
<th>
1
</th>
<td>
101
</td>
<td>
b
</td>
</tr>
<tr>
<th>
2
</th>
<td>
102
</td>
<td>
c
</td>
</tr>
<tr>
<th>
3
</th>
<td>
103
</td>
<td>
d
</td>
</tr>
<tr>
<th>
4
</th>
<td>
104
</td>
<td>
e
</td>
</tr>
</tbody>
</table>

### Functions as methods

``` python
df.len()
```

    5

### New methods

``` python
df.col_1.minmax
```

    (100, 104)

### Utility functions

``` python
df = dummydf()
df.to_html()
```

<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>
</th>
<th>
col_1
</th>
<th>
col_2
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
0
</th>
<td>
100
</td>
<td>
a
</td>
</tr>
<tr>
<th>
1
</th>
<td>
101
</td>
<td>
b
</td>
</tr>
<tr>
<th>
2
</th>
<td>
102
</td>
<td>
c
</td>
</tr>
<tr>
<th>
3
</th>
<td>
103
</td>
<td>
d
</td>
</tr>
<tr>
<th>
4
</th>
<td>
104
</td>
<td>
e
</td>
</tr>
</tbody>
</table>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/asappinc/pdpatch/tree/main/",
    "name": "pdpatch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "pandas patch",
    "author": "Andres Babino",
    "author_email": "ababino@asapp.com",
    "download_url": "https://files.pythonhosted.org/packages/49/77/79557987a6bc0526109b73cbc14fa46a5053675fe7519447c8e9626b7eda/pdpatch-0.1.9.tar.gz",
    "platform": null,
    "description": "pdpatch\n================\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n`pdpatch` adds methods to [pandas](https://pandas.pydata.org/)\u2019\n`DataFrame` and `Series` for a faster data science pipeline. It also\ndefines drop-in replacements for `seaborn` and `plotly.express` that\nautomatically label axes with nicer titles. We use\n[nbdev](https://nbdev.fast.ai/) to build this project.\n\n## Install\n\n`pip install pdpatch`\n\n## How to use\n\n``` python\nfrom pdpatch.all import *\n```\n\n### Interactive Method `.less()`\n\n![Alt Text](less15_360.gif)\n\n### Automatically Rename snake_case columns in `plotly.express` and `seaborn`\n\n``` python\nimport pandas as pd\nfrom pdpatch.express import *\ndf = pd.DataFrame({'time__s__': range(10), 'position__m__': [i**1.3 for i in range(10)], 'speed__m/s__': 10*[1]})\n#df = pd.DataFrame({'time__s__': range(10), 'position__m__': range(10)})\npx.scatter(df, x='time__s__', y='position__m__').show('png')\n```\n\n![](index_files/figure-gfm/cell-3-output-1.png)\n\n``` python\nfrom pdpatch.seaborn import sns\nsns.scatterplot(data=df, x='time__s__', y='position__m__');\n```\n\n![](index_files/figure-gfm/cell-4-output-1.png)\n\n### Add Altair-like Operation to plotly Figures\n\n``` python\nfig = px.scatter(df,x='time__s__', y='time__s__') | px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])\nfig.show('png')\n```\n\n![](index_files/figure-gfm/cell-5-output-1.png)\n\n``` python\nfig = px.scatter(df,x='time__s__', y='time__s__') / px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])\nfig.show('png')\n```\n\n![](index_files/figure-gfm/cell-6-output-1.png)\n\n``` python\nfig = px.scatter(df,x='time__s__', y='time__s__') | px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])\n(fig / fig).show('png')\n```\n\n![](index_files/figure-gfm/cell-7-output-1.png)\n\n### Shorter methods\n\n`df.rename(columns={'col_1': 'new_name'})`-\\>`df.renamec('col_1', 'new_name')`\n\n``` python\ndf = dummydf()\ndf.renamec('col_1', 'new_name').to_html()\n```\n\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n</th>\n<th>\nnew_name\n</th>\n<th>\ncol_2\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<th>\n0\n</th>\n<td>\n100\n</td>\n<td>\na\n</td>\n</tr>\n<tr>\n<th>\n1\n</th>\n<td>\n101\n</td>\n<td>\nb\n</td>\n</tr>\n<tr>\n<th>\n2\n</th>\n<td>\n102\n</td>\n<td>\nc\n</td>\n</tr>\n<tr>\n<th>\n3\n</th>\n<td>\n103\n</td>\n<td>\nd\n</td>\n</tr>\n<tr>\n<th>\n4\n</th>\n<td>\n104\n</td>\n<td>\ne\n</td>\n</tr>\n</tbody>\n</table>\n\n### Functions as methods\n\n``` python\ndf.len()\n```\n\n    5\n\n### New methods\n\n``` python\ndf.col_1.minmax\n```\n\n    (100, 104)\n\n### Utility functions\n\n``` python\ndf = dummydf()\ndf.to_html()\n```\n\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n</th>\n<th>\ncol_1\n</th>\n<th>\ncol_2\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<th>\n0\n</th>\n<td>\n100\n</td>\n<td>\na\n</td>\n</tr>\n<tr>\n<th>\n1\n</th>\n<td>\n101\n</td>\n<td>\nb\n</td>\n</tr>\n<tr>\n<th>\n2\n</th>\n<td>\n102\n</td>\n<td>\nc\n</td>\n</tr>\n<tr>\n<th>\n3\n</th>\n<td>\n103\n</td>\n<td>\nd\n</td>\n</tr>\n<tr>\n<th>\n4\n</th>\n<td>\n104\n</td>\n<td>\ne\n</td>\n</tr>\n</tbody>\n</table>\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "New methods for pandas DataFrame and Series.",
    "version": "0.1.9",
    "split_keywords": [
        "pandas",
        "patch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb5b20ad50584f69372f6f87185fec9a0c315c939bec5ac4006ba00ec5b18d18",
                "md5": "183b9013f5f27e87b57d97db9225eb57",
                "sha256": "3ec9644c368223b6dfac192cd0f5d701207006ebdd17e8186fd560149a09bd8d"
            },
            "downloads": -1,
            "filename": "pdpatch-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "183b9013f5f27e87b57d97db9225eb57",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 12739,
            "upload_time": "2023-03-27T19:54:51",
            "upload_time_iso_8601": "2023-03-27T19:54:51.668354Z",
            "url": "https://files.pythonhosted.org/packages/fb/5b/20ad50584f69372f6f87185fec9a0c315c939bec5ac4006ba00ec5b18d18/pdpatch-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "497779557987a6bc0526109b73cbc14fa46a5053675fe7519447c8e9626b7eda",
                "md5": "b60824e49ce952bb711ee6b2662809ca",
                "sha256": "57ebc054199f2ed2fb075948ce994e5a1f977740d2ac07cbebd8198b0a6828e1"
            },
            "downloads": -1,
            "filename": "pdpatch-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "b60824e49ce952bb711ee6b2662809ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13935,
            "upload_time": "2023-03-27T19:54:54",
            "upload_time_iso_8601": "2023-03-27T19:54:54.739467Z",
            "url": "https://files.pythonhosted.org/packages/49/77/79557987a6bc0526109b73cbc14fa46a5053675fe7519447c8e9626b7eda/pdpatch-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-27 19:54:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pdpatch"
}
        
Elapsed time: 0.05732s