Skip to main content

Creates a lookup dict from a Pandas DataFrame (tuples as keys / np as values)

pip install a-pandas-ex-lookupdict
from a_pandas_ex_lookupdict import pd_add_lookup_dict

import pandas as pd

pd_add_lookup_dict()

df = pd.read_csv(

    "https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv"

)

di1 = df[:5].d_get_lookup_dict(as_index=["Name", "PassengerId"])

di2 = df[:5].d_get_lookup_dict(

    as_values=["Cabin", "Fare"], as_index=["Name", "PassengerId"]

)



di1

Out[4]: 

{('Braund, Mr. Owen Harris',

  1): array([[0, 3, 'male', 22.0, 1, 0, 'A/5 21171', 7.25, nan, 'S']],

       dtype=object),

 ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  2): array([[1, 1, 'female', 38.0, 1, 0, 'PC 17599', 71.2833, 'C85', 'C']],

       dtype=object),

 ('Heikkinen, Miss. Laina',

  3): array([[1, 3, 'female', 26.0, 0, 0, 'STON/O2. 3101282', 7.925, nan, 'S']],

       dtype=object),

 ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  4): array([[1, 1, 'female', 35.0, 1, 0, '113803', 53.1, 'C123', 'S']],

       dtype=object)}

	   

	   

di2

Out[5]: 

{('Braund, Mr. Owen Harris', 1): array([[nan, 7.25]], dtype=object),

 ('Cumings, Mrs. John Bradley (Florence Briggs Thayer)',

  2): array([['C85', 71.2833]], dtype=object),

 ('Heikkinen, Miss. Laina', 3): array([[nan, 7.925]], dtype=object),

 ('Futrelle, Mrs. Jacques Heath (Lily May Peel)',

  4): array([['C123', 53.1]], dtype=object)}

Metadata

Release files for a-pandas-ex-lookupdict 0.11

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-lookupdict 0.11
File Size Uploaded Provenance Actions
a_pandas_ex_lookupdict-0.11.tar.gz 3.9 kB Without provenance Details for a_pandas_ex_lookupdict-0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-pandas-ex-lookupdict 0.11
File Interpreter ABI Platform Actions
a_pandas_ex_lookupdict-0.11-py3-none-any.whl Python 3 none any Details for a_pandas_ex_lookupdict-0.11-py3-none-any.whl

Total release size: 9.6 kB

Release files / a_pandas_ex_lookupdict-0.11.tar.gz

Download URL a_pandas_ex_lookupdict-0.11.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2de445cc6c2efd5d95f90e0e8f5a2ec156600e1ea58d412f2555d4d38de2505a
BLAKE2b-256 checksum
How to use checksums
c84e722fe54aca85ae5d6af978a870d6a2e92f3d91542a8b0454e98de5ef1633
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_lookupdict-0.11-py3-none-any.whl

Download URL a_pandas_ex_lookupdict-0.11-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d92f4bd19ff39a1c3d614f82ed85a3c3c5b2895bcbafebe6f55f4ce543279045
BLAKE2b-256 checksum
How to use checksums
a765f3a826d7bf1164cb2002b4bc419425723606f789c97ab30b4af089b1e045
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-lookupdict 0.11

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.11 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