Skip to main content

hashable_df

If you have ever tried to use native python objects in Pandas DataFrames, you may have run into an issue similar to this:

df = pd.DataFrame({"A": [1, 2, 3, 4],
                   "B": ["a", "b", "c", "d"],
                   "C": [[1, 2, 3], [1, 2], [1, 2, 3], 4],
                   "D": [{1: 1, 2: 2}, {1: 1, 3: 3}, {1: 1, 4: 4}, {1: 1, 2: 2}],
                   "E": [[{1: {2: 2}}, {2: {3: 3}}], [{1: {2: 2}}, {2: {3: 3}}],
                         [{1: {2: 2}}, {2: {3: 3}}], [{1: {2: 2}}, {2: {3: 3}}]]
                   })
df['C'].unique()

TypeError: unhashable type: 'list'

This is caused by unhashable values in the DataFrame cells.

This small library helps to resolve that making this possible:

from hashable_df import hashable_df
hashable_df(df)['E'].unique()

returning

array([[{1: {2: 2}}, {2: {3: 3}}]], dtype=object)

Metadata

Release files for hashable-df 0.0.8

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

Source distribution (sdist)

Source distribution for hashable-df 0.0.8
File Size Uploaded
hashable_df-0.0.8.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hashable-df 0.0.8
File Interpreter ABI Platform
hashable_df-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 kB

Release files / hashable_df-0.0.8.tar.gz

Download URL hashable_df-0.0.8.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cde2fe6adea96a030507f7b7770332ac6d6a5770c55d30bb355199401272a545
BLAKE2b-256 checksum
How to use checksums
8d03b21249e806969ed6d82985b5c721392f839ab4caba91c8781014740e97f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / hashable_df-0.0.8-py3-none-any.whl

Download URL hashable_df-0.0.8-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f8ed9603f3e6f5a1e70a5b56b27a89b1a401e5ef19146b05063045e9b34573a
BLAKE2b-256 checksum
How to use checksums
dd1411caab481d9d5dcb039d381dc615eab88d1281a180778185f7c511f19f14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.2

2 release files

0.0.1

1 release file

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