Skip to main content

Cache Pandas Dataframes to Disk

Easily cache Pandas Dataframes to disk using a simple interface.

Sample usage

from cache_df import CacheDF
import pandas as pd

cache = CacheDF(cache_dir='./caches')

# Caching a dataframe
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
cache.cache(df, 'my_df')

# Checking if a dataframe is cached
df_is_cached = cache.is_cached('my_df')

# Reading a dataframe from cache
try:
    df = cache.read('my_df')
    df_selective_cols = cache.read('my_df', columns=['a'])  # Read only a subset of columns
except FileNotFoundError:
    print('Dataframe not cached')

# Deleting a dataframe from cache if it exists
cache.uncache('my_df')

# Clearing all cached dataframes
cache.clear()

Where it can be used

  1. It can be used when you are using a shared file system across multiple machines such as AWS EFS, GCP Filestore, Azure Files, etc.

Metadata

Release files for cache-df 1.1

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

Source distribution (sdist)

Source distribution for cache-df 1.1
File Size Uploaded
cache_df-1.1.tar.gz 2.9 kB Details

Release files / cache_df-1.1.tar.gz

Download URL cache_df-1.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b2925bfa5b4258eac306dc51e9bb77a869b6a64d7935ad3717d0754d96bcf4af
BLAKE2b-256 checksum
How to use checksums
1add3cd0b92d7950a7bf323ce622c30b3ea75a77a2cf2baf292aeaa0a9951e3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

1.0

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.2

1 release file

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