f2m: Turn user-defined functions into methods
Pandas DataFrame example
import pandas as pd
from f2m import f2m
# create a new class that inherits from pd.DataFrame
# and includes methods defined in a 'helper.py' file
F2mFrame = f2m(cls=pd.DataFrame, src='helper')
# instantiate the new class
df = F2mFrame(data=pd.read_csv('risk_factors_cervical_cancer.csv'))
# test methods added from helper file
df.say_hi()
df.say_moo()
# test method from parent class
df.head(n=1)
# confirm that df is an instance of pd.DataFrame and PydyFrame
isinstance(df, (pd.DataFrame, F2mFrame))
# confirm that F2mFrame is a subclass of pd.DataFrame
issubclass(F2mFrame, pd.DataFrame)
Metadata
Release files for f2m 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| f2m-0.0.1.tar.gz | 1.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| f2m-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.1 kB
Release files / f2m-0.0.1.tar.gz
| Download URL | f2m-0.0.1.tar.gz |
|---|---|
| Size | 1.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bcff066cfd3c56b3750f40564b64b9b1cc773eca3e56653225d1495b7cba319
|
|
BLAKE2b-256 checksum How to use checksums |
7a893fe7e79e62d7fe74f4ac117530c25ee69a0c92f773141a1a2233adbcf26f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Release files / f2m-0.0.1-py3-none-any.whl
| Download URL | f2m-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75e9e081810638a398ea3dd89ea3631276cc3f1428776543eceec00adbbc1885
|
|
BLAKE2b-256 checksum How to use checksums |
9adb3e2fbf72b919b46aeaf30070ed1528a85b8f228f07396fd1d387d128e680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|