a-pandas-ex-to-tuple
توضیحات
Converts pandas DataFrames/Series into Iterator[tuple]
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | a-pandas-ex-to-tuple-0.10 |
| نام | a-pandas-ex-to-tuple |
| نسخه کتابخانه | 0.10 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Johannes Fischer |
| ایمیل نویسنده | <aulasparticularesdealemaosp@gmail.com> |
| آدرس صفحه اصلی | https://github.com/hansalemaos/a_pandas_ex_to_tuple |
| آدرس اینترنتی | https://pypi.org/project/a-pandas-ex-to-tuple/ |
| مجوز | MIT |
# 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',))
```
نیازمندی
| مقدار | نام |
|---|---|
| - | pandas |
نحوه نصب
نصب پکیج whl a-pandas-ex-to-tuple-0.10:
pip install a-pandas-ex-to-tuple.whl
نصب پکیج tar.gz a-pandas-ex-to-tuple-0.10:
pip install a-pandas-ex-to-tuple.tar.gz