Skip to main content

Converts pandas DataFrames/Series into Iterator[tuple]

pip install a-pandas-ex-to-tuple
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',))

Metadata

Release files for a-pandas-ex-to-tuple 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a-pandas-ex-to-tuple 0.10
File Size Uploaded Provenance Actions
a_pandas_ex_to_tuple-0.10.tar.gz 5.0 kB Without provenance Details for a_pandas_ex_to_tuple-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-pandas-ex-to-tuple 0.10
File Interpreter ABI Platform Actions
a_pandas_ex_to_tuple-0.10-py3-none-any.whl Python 3 none any Details for a_pandas_ex_to_tuple-0.10-py3-none-any.whl

Total release size: 10.9 kB

Release files / a_pandas_ex_to_tuple-0.10.tar.gz

Download URL a_pandas_ex_to_tuple-0.10.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e3b8b54d662c55d2a7524932a185021161dee16b804f9032fb67d9bf1a474806
BLAKE2b-256 checksum
How to use checksums
aa812e3cab9f5789fca1ce17c6ab108b3bb9f9354f60c2e563545f6247cc1385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / a_pandas_ex_to_tuple-0.10-py3-none-any.whl

Download URL a_pandas_ex_to_tuple-0.10-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9ac9dcbbf57adb374f43e79e0a898a0b0978b876696eb9737bcb0f9608b8e49
BLAKE2b-256 checksum
How to use checksums
ec57ac4ad0d9df86fef2278ad44a61ec33699d62150e2f517c5b78164abe7e55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for a-pandas-ex-to-tuple 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page