Skip to main content

Creates a DataFrame/Series from duplicates

pip install a-pandas-ex-duplicates-to-df



from a_pandas_ex_duplicates_to_df import pd_add_duplicates_to_df

import pandas as pd

pd_add_duplicates_to_df()

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

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

    :50

]

df = pd.concat([df, df2], ignore_index=True)

dupl = df.ds_get_duplicates()





dupl

Out[5]: 

    PassengerId  Survived  Pclass  ... Cabin Embarked  DUPLICATEINDEX

0             1         0       3  ...   NaN        S        (0, 891)

1             1         0       3  ...   NaN        S        (0, 891)

2            10         1       2  ...   NaN        C        (9, 900)

3            10         1       2  ...   NaN        C        (9, 900)

4            11         1       3  ...    G6        S       (10, 901)

..          ...       ...     ...  ...   ...      ...             ...

95            7         0       1  ...   E46        S        (6, 897)

96            8         0       3  ...   NaN        S        (7, 898)

97            8         0       3  ...   NaN        S        (7, 898)

98            9         1       3  ...   NaN        S        (8, 899)

99            9         1       3  ...   NaN        S        (8, 899)

[100 rows x 13 columns]





dupl2=df.ds_get_duplicates(subset=['Survived'])

dupl2

Out[7]: 

     PassengerId  ...                                     DUPLICATEINDEX

0              1  ...  (0, 4, 5, 6, 7, 12, 13, 14, 16, 18, 20, 24, 26...

1              5  ...  (0, 4, 5, 6, 7, 12, 13, 14, 16, 18, 20, 24, 26...

2              6  ...  (0, 4, 5, 6, 7, 12, 13, 14, 16, 18, 20, 24, 26...

3              7  ...  (0, 4, 5, 6, 7, 12, 13, 14, 16, 18, 20, 24, 26...

4              8  ...  (0, 4, 5, 6, 7, 12, 13, 14, 16, 18, 20, 24, 26...

..           ...  ...                                                ...

936           37  ...  (1, 2, 3, 8, 9, 10, 11, 15, 17, 19, 21, 22, 23...

937           40  ...  (1, 2, 3, 8, 9, 10, 11, 15, 17, 19, 21, 22, 23...

938           44  ...  (1, 2, 3, 8, 9, 10, 11, 15, 17, 19, 21, 22, 23...

939           45  ...  (1, 2, 3, 8, 9, 10, 11, 15, 17, 19, 21, 22, 23...

940           48  ...  (1, 2, 3, 8, 9, 10, 11, 15, 17, 19, 21, 22, 23...

[941 rows x 13 columns]





df.Embarked.ds_get_duplicates()



    Embarked                                     DUPLICATEINDEX

0        NaN                                          (61, 829)

1        NaN                                          (61, 829)

2          C  (1, 9, 19, 26, 30, 31, 34, 36, 39, 42, 43, 48,...

3          C  (1, 9, 19, 26, 30, 31, 34, 36, 39, 42, 43, 48,...

4          C  (1, 9, 19, 26, 30, 31, 34, 36, 39, 42, 43, 48,...

..       ...                                                ...

936        S  (0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, ...

937        S  (0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, ...

938        S  (0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, ...

939        S  (0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, ...

940        S  (0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, ...

[941 rows x 2 columns]

Metadata

Release files for a-pandas-ex-duplicates-to-df 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-duplicates-to-df 0.10
File Size Uploaded Provenance Actions
a_pandas_ex_duplicates_to_df-0.10.tar.gz 4.4 kB Without provenance Details for a_pandas_ex_duplicates_to_df-0.10.tar.gz

Built distribution (wheel)

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

Total release size: 10.6 kB

Release files / a_pandas_ex_duplicates_to_df-0.10.tar.gz

Download URL a_pandas_ex_duplicates_to_df-0.10.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
10ec9fe3aee744f67a8a1293e9d1740fc7d311e352dcc37069ef1c2dbc4ea9cd
BLAKE2b-256 checksum
How to use checksums
e6d9273645c58ffbe7223c8c76e93ee447672ebaf74c7dce8c2a1bf4f64ca1d2
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_duplicates_to_df-0.10-py3-none-any.whl

Download URL a_pandas_ex_duplicates_to_df-0.10-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dec20ca311c13bda87d690a25879b81938793ac150750037cb401f7f3df1502
BLAKE2b-256 checksum
How to use checksums
c08f981bc62bbeacba7dd0c498e1a1386d5e59fe40eb92c1f5bad145738ed61d
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-duplicates-to-df 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