Pandas DataFrame to dict with crosstab DataFrames
Project description
Pandas DataFrame to dict with crosstab DataFrames
$pip install a-pandas-ex-crosstab-dict
from a_pandas_ex_crosstab_dict import pd_add_crosstab_dict
import pandas as pd
pd_add_crosstab_dict()
df = pd.read_csv(
"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv"
)
df.ds_get_crosstab_dict(maincolumn="Cabin", columns=None)
df.ds_get_crosstab_dict( maincolumn="Cabin", columns=["Survived", "Sex",'Fare'])
Out[5]:
{'Survived': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T
Survived ...
0 1 1 0 1 0 0 1 ... 2 1 0 1 0 2 1
1 0 0 1 0 1 1 0 ... 0 2 3 0 2 2 0
[2 rows x 147 columns],
'Sex': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T
Sex ...
female 0 0 1 0 0 0 0 ... 0 0 3 0 1 4 0
male 1 1 0 1 1 1 1 ... 2 3 0 1 1 0 1
[2 rows x 147 columns],
'Fare': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T
Fare ...
0.0000 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0
5.0000 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0
7.6500 0 0 0 0 0 0 0 ... 2 0 0 0 0 0 0
7.7500 0 0 0 0 0 0 0 ... 0 0 0 1 0 0 0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for a_pandas_ex_crosstab_dict-0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77e688a72df6119be5524c253886dc15f46bf7426a42529841222667f59b59f9 |
|
MD5 | be19172986996167e0ce98ab4510fe91 |
|
BLAKE2b-256 | 6c860114b754bf4d5eda74a1ddaff3b722c389c1c66a860a261fa445ca199b34 |
Close
Hashes for a_pandas_ex_crosstab_dict-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eefc74d5806f72f57ba26df5f4a317b2f8a7ecd19d6bbba31c4aef2761b3d54 |
|
MD5 | f211d53c95655f6a675f76b7398feba3 |
|
BLAKE2b-256 | cc0e1c7ba6acb20a7c60d4d40bffb6d1c57b591c5e1e721e61581afa8f7073fd |