Metadata-Version: 2.1
Name: a_pandas_ex_to_tuple
Version: 0.10
Summary: Converts pandas DataFrames/Series into Iterator[tuple]
Home-page: https://github.com/hansalemaos/a_pandas_ex_to_tuple
Author: Johannes Fischer
Author-email: <aulasparticularesdealemaosp@gmail.com>
License: MIT
Keywords: pandas,DataFrame,Iterator,tuple,convert
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Editors :: Text Processing
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Text Processing :: Indexing
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Utilities
Description-Content-Type: text/markdown
License-File: LICENSE.rst


# 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',))



```

