a-pandas-ex-to-tuple


Namea-pandas-ex-to-tuple JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_pandas_ex_to_tuple
SummaryConverts pandas DataFrames/Series into Iterator[tuple]
upload_time2022-12-17 04:29:30
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords pandas dataframe iterator tuple convert
VCS
bugtrack_url
requirements pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Converts pandas DataFrames/Series into Iterator[tuple]



```python

pip install a-pandas-ex-to-tuple

```





```python

from a_pandas_ex_to_tuple import pd_add_tuples

pd_add_tuples()

import pandas as pd

from pprint import pprint

df = pd.read_csv("https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv")

df = df[:5]

# DataFrame

t1 = tuple(df.ds_to_tuples(index=False, columns=True))

t2 = tuple(df.ds_to_tuples(index=True, columns=True))

t3 = tuple(df.ds_to_tuples(index=True, columns=False))

t4 = tuple(df.ds_to_tuples(index=False, columns=False))

pprint(t1)

pprint(t2)

pprint(t3)

pprint(t4)

# Series

t11 = tuple(df.Name.ds_to_tuples( index=False, columns=True))

t21 = tuple(df.Name.ds_to_tuples( index=True, columns=True))

t31 = tuple(df.Name.ds_to_tuples( index=True, columns=False))

t41 = tuple(df.Name.ds_to_tuples( index=False, columns=False))

pprint(t11)

pprint(t21)

pprint(t31)

pprint(t41)

(('PassengerId',

  'Survived',

  'Pclass',

  'Name',

  'Sex',

  'Age',

  'SibSp',

  'Parch',

  'Ticket',

  'Fare',

  'Cabin',

  'Embarked'),

 (1,

  0,

  3,

  'Braund, Mr. Owen Harris',

  'male',

  22.0,

  1,

  0,

  'A/5 21171',

  7.25,

  nan,

  'S'),

 (2,

  1,

  1,

  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  'female',

  38.0,

  1,

  0,

  'PC 17599',

  71.2833,

  'C85',

  'C'),

 (3,

  1,

  3,

  'Heikkinen, Miss. Laina',

  'female',

  26.0,

  0,

  0,

  'STON/O2. 3101282',

  7.925,

  nan,

  'S'),

 (4,

  1,

  1,

  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  'female',

  35.0,

  1,

  0,

  '113803',

  53.1,

  'C123',

  'S'),

 (5,

  0,

  3,

  'Allen, Mr. William Henry',

  'male',

  35.0,

  0,

  0,

  '373450',

  8.05,

  nan,

  'S'))

(('index',

  'PassengerId',

  'Survived',

  'Pclass',

  'Name',

  'Sex',

  'Age',

  'SibSp',

  'Parch',

  'Ticket',

  'Fare',

  'Cabin',

  'Embarked'),

 (0,

  1,

  0,

  3,

  'Braund, Mr. Owen Harris',

  'male',

  22.0,

  1,

  0,

  'A/5 21171',

  7.25,

  nan,

  'S'),

 (1,

  2,

  1,

  1,

  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  'female',

  38.0,

  1,

  0,

  'PC 17599',

  71.2833,

  'C85',

  'C'),

 (2,

  3,

  1,

  3,

  'Heikkinen, Miss. Laina',

  'female',

  26.0,

  0,

  0,

  'STON/O2. 3101282',

  7.925,

  nan,

  'S'),

 (3,

  4,

  1,

  1,

  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  'female',

  35.0,

  1,

  0,

  '113803',

  53.1,

  'C123',

  'S'),

 (4,

  5,

  0,

  3,

  'Allen, Mr. William Henry',

  'male',

  35.0,

  0,

  0,

  '373450',

  8.05,

  nan,

  'S'))

((0,

  1,

  0,

  3,

  'Braund, Mr. Owen Harris',

  'male',

  22.0,

  1,

  0,

  'A/5 21171',

  7.25,

  nan,

  'S'),

 (1,

  2,

  1,

  1,

  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  'female',

  38.0,

  1,

  0,

  'PC 17599',

  71.2833,

  'C85',

  'C'),

 (2,

  3,

  1,

  3,

  'Heikkinen, Miss. Laina',

  'female',

  26.0,

  0,

  0,

  'STON/O2. 3101282',

  7.925,

  nan,

  'S'),

 (3,

  4,

  1,

  1,

  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  'female',

  35.0,

  1,

  0,

  '113803',

  53.1,

  'C123',

  'S'),

 (4,

  5,

  0,

  3,

  'Allen, Mr. William Henry',

  'male',

  35.0,

  0,

  0,

  '373450',

  8.05,

  nan,

  'S'))

((1,

  0,

  3,

  'Braund, Mr. Owen Harris',

  'male',

  22.0,

  1,

  0,

  'A/5 21171',

  7.25,

  nan,

  'S'),

 (2,

  1,

  1,

  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  'female',

  38.0,

  1,

  0,

  'PC 17599',

  71.2833,

  'C85',

  'C'),

 (3,

  1,

  3,

  'Heikkinen, Miss. Laina',

  'female',

  26.0,

  0,

  0,

  'STON/O2. 3101282',

  7.925,

  nan,

  'S'),

 (4,

  1,

  1,

  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  'female',

  35.0,

  1,

  0,

  '113803',

  53.1,

  'C123',

  'S'),

 (5,

  0,

  3,

  'Allen, Mr. William Henry',

  'male',

  35.0,

  0,

  0,

  '373450',

  8.05,

  nan,

  'S'))

(('Name',),

 ('Braund, Mr. Owen Harris',),

 ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',),

 ('Heikkinen, Miss. Laina',),

 ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',),

 ('Allen, Mr. William Henry',))

(('index', 'Name'),

 (0, 'Braund, Mr. Owen Harris'),

 (1, 'Cumings, Mrs. John Bradley (Florence Briggs Thayer)'),

 (2, 'Heikkinen, Miss. Laina'),

 (3, 'Futrelle, Mrs. Jacques Heath (Lily May Peel)'),

 (4, 'Allen, Mr. William Henry'))

((0, 'Braund, Mr. Owen Harris'),

 (1, 'Cumings, Mrs. John Bradley (Florence Briggs Thayer)'),

 (2, 'Heikkinen, Miss. Laina'),

 (3, 'Futrelle, Mrs. Jacques Heath (Lily May Peel)'),

 (4, 'Allen, Mr. William Henry'))

(('Braund, Mr. Owen Harris',),

 ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',),

 ('Heikkinen, Miss. Laina',),

 ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',),

 ('Allen, Mr. William Henry',))



```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_pandas_ex_to_tuple",
    "name": "a-pandas-ex-to-tuple",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pandas,DataFrame,Iterator,tuple,convert",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/aa/81/2e3cab9f5789fca1ce17c6ab108b3bb9f9354f60c2e563545f6247cc1385/a_pandas_ex_to_tuple-0.10.tar.gz",
    "platform": null,
    "description": "\n# Converts pandas DataFrames/Series into Iterator[tuple]\n\n\n\n```python\n\npip install a-pandas-ex-to-tuple\n\n```\n\n\n\n\n\n```python\n\nfrom a_pandas_ex_to_tuple import pd_add_tuples\n\npd_add_tuples()\n\nimport pandas as pd\n\nfrom pprint import pprint\n\ndf = pd.read_csv(\"https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv\")\n\ndf = df[:5]\n\n# DataFrame\n\nt1 = tuple(df.ds_to_tuples(index=False, columns=True))\n\nt2 = tuple(df.ds_to_tuples(index=True, columns=True))\n\nt3 = tuple(df.ds_to_tuples(index=True, columns=False))\n\nt4 = tuple(df.ds_to_tuples(index=False, columns=False))\n\npprint(t1)\n\npprint(t2)\n\npprint(t3)\n\npprint(t4)\n\n# Series\n\nt11 = tuple(df.Name.ds_to_tuples( index=False, columns=True))\n\nt21 = tuple(df.Name.ds_to_tuples( index=True, columns=True))\n\nt31 = tuple(df.Name.ds_to_tuples( index=True, columns=False))\n\nt41 = tuple(df.Name.ds_to_tuples( index=False, columns=False))\n\npprint(t11)\n\npprint(t21)\n\npprint(t31)\n\npprint(t41)\n\n(('PassengerId',\n\n  'Survived',\n\n  'Pclass',\n\n  'Name',\n\n  'Sex',\n\n  'Age',\n\n  'SibSp',\n\n  'Parch',\n\n  'Ticket',\n\n  'Fare',\n\n  'Cabin',\n\n  'Embarked'),\n\n (1,\n\n  0,\n\n  3,\n\n  'Braund, Mr. Owen Harris',\n\n  'male',\n\n  22.0,\n\n  1,\n\n  0,\n\n  'A/5 21171',\n\n  7.25,\n\n  nan,\n\n  'S'),\n\n (2,\n\n  1,\n\n  1,\n\n  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',\n\n  'female',\n\n  38.0,\n\n  1,\n\n  0,\n\n  'PC 17599',\n\n  71.2833,\n\n  'C85',\n\n  'C'),\n\n (3,\n\n  1,\n\n  3,\n\n  'Heikkinen, Miss. Laina',\n\n  'female',\n\n  26.0,\n\n  0,\n\n  0,\n\n  'STON/O2. 3101282',\n\n  7.925,\n\n  nan,\n\n  'S'),\n\n (4,\n\n  1,\n\n  1,\n\n  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',\n\n  'female',\n\n  35.0,\n\n  1,\n\n  0,\n\n  '113803',\n\n  53.1,\n\n  'C123',\n\n  'S'),\n\n (5,\n\n  0,\n\n  3,\n\n  'Allen, Mr. William Henry',\n\n  'male',\n\n  35.0,\n\n  0,\n\n  0,\n\n  '373450',\n\n  8.05,\n\n  nan,\n\n  'S'))\n\n(('index',\n\n  'PassengerId',\n\n  'Survived',\n\n  'Pclass',\n\n  'Name',\n\n  'Sex',\n\n  'Age',\n\n  'SibSp',\n\n  'Parch',\n\n  'Ticket',\n\n  'Fare',\n\n  'Cabin',\n\n  'Embarked'),\n\n (0,\n\n  1,\n\n  0,\n\n  3,\n\n  'Braund, Mr. Owen Harris',\n\n  'male',\n\n  22.0,\n\n  1,\n\n  0,\n\n  'A/5 21171',\n\n  7.25,\n\n  nan,\n\n  'S'),\n\n (1,\n\n  2,\n\n  1,\n\n  1,\n\n  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',\n\n  'female',\n\n  38.0,\n\n  1,\n\n  0,\n\n  'PC 17599',\n\n  71.2833,\n\n  'C85',\n\n  'C'),\n\n (2,\n\n  3,\n\n  1,\n\n  3,\n\n  'Heikkinen, Miss. Laina',\n\n  'female',\n\n  26.0,\n\n  0,\n\n  0,\n\n  'STON/O2. 3101282',\n\n  7.925,\n\n  nan,\n\n  'S'),\n\n (3,\n\n  4,\n\n  1,\n\n  1,\n\n  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',\n\n  'female',\n\n  35.0,\n\n  1,\n\n  0,\n\n  '113803',\n\n  53.1,\n\n  'C123',\n\n  'S'),\n\n (4,\n\n  5,\n\n  0,\n\n  3,\n\n  'Allen, Mr. William Henry',\n\n  'male',\n\n  35.0,\n\n  0,\n\n  0,\n\n  '373450',\n\n  8.05,\n\n  nan,\n\n  'S'))\n\n((0,\n\n  1,\n\n  0,\n\n  3,\n\n  'Braund, Mr. Owen Harris',\n\n  'male',\n\n  22.0,\n\n  1,\n\n  0,\n\n  'A/5 21171',\n\n  7.25,\n\n  nan,\n\n  'S'),\n\n (1,\n\n  2,\n\n  1,\n\n  1,\n\n  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',\n\n  'female',\n\n  38.0,\n\n  1,\n\n  0,\n\n  'PC 17599',\n\n  71.2833,\n\n  'C85',\n\n  'C'),\n\n (2,\n\n  3,\n\n  1,\n\n  3,\n\n  'Heikkinen, Miss. Laina',\n\n  'female',\n\n  26.0,\n\n  0,\n\n  0,\n\n  'STON/O2. 3101282',\n\n  7.925,\n\n  nan,\n\n  'S'),\n\n (3,\n\n  4,\n\n  1,\n\n  1,\n\n  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',\n\n  'female',\n\n  35.0,\n\n  1,\n\n  0,\n\n  '113803',\n\n  53.1,\n\n  'C123',\n\n  'S'),\n\n (4,\n\n  5,\n\n  0,\n\n  3,\n\n  'Allen, Mr. William Henry',\n\n  'male',\n\n  35.0,\n\n  0,\n\n  0,\n\n  '373450',\n\n  8.05,\n\n  nan,\n\n  'S'))\n\n((1,\n\n  0,\n\n  3,\n\n  'Braund, Mr. Owen Harris',\n\n  'male',\n\n  22.0,\n\n  1,\n\n  0,\n\n  'A/5 21171',\n\n  7.25,\n\n  nan,\n\n  'S'),\n\n (2,\n\n  1,\n\n  1,\n\n  'Cumings, Mrs. John Bradley (Florence Briggs Thayer)',\n\n  'female',\n\n  38.0,\n\n  1,\n\n  0,\n\n  'PC 17599',\n\n  71.2833,\n\n  'C85',\n\n  'C'),\n\n (3,\n\n  1,\n\n  3,\n\n  'Heikkinen, Miss. Laina',\n\n  'female',\n\n  26.0,\n\n  0,\n\n  0,\n\n  'STON/O2. 3101282',\n\n  7.925,\n\n  nan,\n\n  'S'),\n\n (4,\n\n  1,\n\n  1,\n\n  'Futrelle, Mrs. Jacques Heath (Lily May Peel)',\n\n  'female',\n\n  35.0,\n\n  1,\n\n  0,\n\n  '113803',\n\n  53.1,\n\n  'C123',\n\n  'S'),\n\n (5,\n\n  0,\n\n  3,\n\n  'Allen, Mr. William Henry',\n\n  'male',\n\n  35.0,\n\n  0,\n\n  0,\n\n  '373450',\n\n  8.05,\n\n  nan,\n\n  'S'))\n\n(('Name',),\n\n ('Braund, Mr. Owen Harris',),\n\n ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',),\n\n ('Heikkinen, Miss. Laina',),\n\n ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',),\n\n ('Allen, Mr. William Henry',))\n\n(('index', 'Name'),\n\n (0, 'Braund, Mr. Owen Harris'),\n\n (1, 'Cumings, Mrs. John Bradley (Florence Briggs Thayer)'),\n\n (2, 'Heikkinen, Miss. Laina'),\n\n (3, 'Futrelle, Mrs. Jacques Heath (Lily May Peel)'),\n\n (4, 'Allen, Mr. William Henry'))\n\n((0, 'Braund, Mr. Owen Harris'),\n\n (1, 'Cumings, Mrs. John Bradley (Florence Briggs Thayer)'),\n\n (2, 'Heikkinen, Miss. Laina'),\n\n (3, 'Futrelle, Mrs. Jacques Heath (Lily May Peel)'),\n\n (4, 'Allen, Mr. William Henry'))\n\n(('Braund, Mr. Owen Harris',),\n\n ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',),\n\n ('Heikkinen, Miss. Laina',),\n\n ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',),\n\n ('Allen, Mr. William Henry',))\n\n\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Converts pandas DataFrames/Series into Iterator[tuple]",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/a_pandas_ex_to_tuple"
    },
    "split_keywords": [
        "pandas",
        "dataframe",
        "iterator",
        "tuple",
        "convert"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec57ac4ad0d9df86fef2278ad44a61ec33699d62150e2f517c5b78164abe7e55",
                "md5": "860f8d7bdb8620999c8d7655a7b428a1",
                "sha256": "c9ac9dcbbf57adb374f43e79e0a898a0b0978b876696eb9737bcb0f9608b8e49"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_to_tuple-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "860f8d7bdb8620999c8d7655a7b428a1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5916,
            "upload_time": "2022-12-17T04:29:28",
            "upload_time_iso_8601": "2022-12-17T04:29:28.253478Z",
            "url": "https://files.pythonhosted.org/packages/ec/57/ac4ad0d9df86fef2278ad44a61ec33699d62150e2f517c5b78164abe7e55/a_pandas_ex_to_tuple-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aa812e3cab9f5789fca1ce17c6ab108b3bb9f9354f60c2e563545f6247cc1385",
                "md5": "ad2f8c573709a8bf93d8a87b253da366",
                "sha256": "e3b8b54d662c55d2a7524932a185021161dee16b804f9032fb67d9bf1a474806"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_to_tuple-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "ad2f8c573709a8bf93d8a87b253da366",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4992,
            "upload_time": "2022-12-17T04:29:30",
            "upload_time_iso_8601": "2022-12-17T04:29:30.292021Z",
            "url": "https://files.pythonhosted.org/packages/aa/81/2e3cab9f5789fca1ce17c6ab108b3bb9f9354f60c2e563545f6247cc1385/a_pandas_ex_to_tuple-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-17 04:29:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "a_pandas_ex_to_tuple",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "a-pandas-ex-to-tuple"
}
        
Elapsed time: 0.42639s