# Pandas DataFrame to dict with crosstab DataFrames
```python
$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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/a_pandas_ex_crosstab_dict",
"name": "a-pandas-ex-crosstab-dict",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pandas,crosstab,DataFrame,merge,concat,Series",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6c/86/0114b754bf4d5eda74a1ddaff3b722c389c1c66a860a261fa445ca199b34/a_pandas_ex_crosstab_dict-0.10.tar.gz",
"platform": null,
"description": "\n# Pandas DataFrame to dict with crosstab DataFrames \n\n\n\n```python\n\n\n\n$pip install a-pandas-ex-crosstab-dict\n\n\n\nfrom a_pandas_ex_crosstab_dict import pd_add_crosstab_dict\n\nimport pandas as pd\n\npd_add_crosstab_dict()\n\ndf = pd.read_csv(\n\n \"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv\"\n\n)\n\ndf.ds_get_crosstab_dict(maincolumn=\"Cabin\", columns=None)\n\ndf.ds_get_crosstab_dict( maincolumn=\"Cabin\", columns=[\"Survived\", \"Sex\",'Fare'])\n\nOut[5]: \n\n{'Survived': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T\n\n Survived ... \n\n 0 1 1 0 1 0 0 1 ... 2 1 0 1 0 2 1\n\n 1 0 0 1 0 1 1 0 ... 0 2 3 0 2 2 0\n\n \n\n [2 rows x 147 columns],\n\n 'Sex': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T\n\n Sex ... \n\n female 0 0 1 0 0 0 0 ... 0 0 3 0 1 4 0\n\n male 1 1 0 1 1 1 1 ... 2 3 0 1 1 0 1\n\n \n\n [2 rows x 147 columns],\n\n 'Fare': Cabin A10 A14 A16 A19 A20 A23 A24 ... F G73 F2 F33 F38 F4 G6 T\n\n Fare ... \n\n 0.0000 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0\n\n 5.0000 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0\n\n 7.6500 0 0 0 0 0 0 0 ... 2 0 0 0 0 0 0\n\n 7.7500 0 0 0 0 0 0 0 ... 0 0 0 1 0 0 0\n\n\n\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pandas DataFrame to dict with crosstab DataFrames",
"version": "0.10",
"split_keywords": [
"pandas",
"crosstab",
"dataframe",
"merge",
"concat",
"series"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f211d53c95655f6a675f76b7398feba3",
"sha256": "7eefc74d5806f72f57ba26df5f4a317b2f8a7ecd19d6bbba31c4aef2761b3d54"
},
"downloads": -1,
"filename": "a_pandas_ex_crosstab_dict-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f211d53c95655f6a675f76b7398feba3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5243,
"upload_time": "2022-12-15T13:20:24",
"upload_time_iso_8601": "2022-12-15T13:20:24.890818Z",
"url": "https://files.pythonhosted.org/packages/cc/0e/1c7ba6acb20a7c60d4d40bffb6d1c57b591c5e1e721e61581afa8f7073fd/a_pandas_ex_crosstab_dict-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "be19172986996167e0ce98ab4510fe91",
"sha256": "77e688a72df6119be5524c253886dc15f46bf7426a42529841222667f59b59f9"
},
"downloads": -1,
"filename": "a_pandas_ex_crosstab_dict-0.10.tar.gz",
"has_sig": false,
"md5_digest": "be19172986996167e0ce98ab4510fe91",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3582,
"upload_time": "2022-12-15T13:20:26",
"upload_time_iso_8601": "2022-12-15T13:20:26.539012Z",
"url": "https://files.pythonhosted.org/packages/6c/86/0114b754bf4d5eda74a1ddaff3b722c389c1c66a860a261fa445ca199b34/a_pandas_ex_crosstab_dict-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-15 13:20:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "a_pandas_ex_crosstab_dict",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "a-pandas-ex-crosstab-dict"
}