Skip to main content

Load tabular data from any storage backend (GCS, S3, Azure, local) and any common format into a pandas DataFrame with a single call.

Project description

loadfile

Load tabular data from any storage backend (Google Cloud Storage, AWS S3, Azure, local disk, …) and any common format into a pandas DataFrame with a single call.

from loadfile import load

df = load("gs://my-bucket/data.parquet")
df = load("data/local.csv")
df = load("s3://bucket/export.json", storage_options={"anon": True})

The storage backend is chosen automatically from the URL prefix (powered by fsspec). The file format is detected from the extension (or forced with format=).

The function is also exported as load_data (an alias of load) for compatibility with the original helper.

Install

pip install loadfile            # core: pandas + fsspec + pyarrow (local files)
pip install "loadfile[gcs]"     # Google Cloud Storage (gcsfs)
pip install "loadfile[s3]"      # AWS S3 (s3fs)
pip install "loadfile[azure]"   # Azure (adlfs)
pip install "loadfile[excel]"   # .xlsx support (openpyxl)
pip install "loadfile[calamine]"# fast Rust Excel engine for fast=True
pip install "loadfile[all]"     # everything

Supported formats

Format Extensions
Parquet .parquet
CSV .csv (and .csv.gz, .csv.bz2…)
JSON / JSON Lines .json, .jsonl, .ndjson
Excel .xlsx, .xls
Feather .feather
ZIP .zip (wrapping any of the above)

Usage

Faster reads with fast=True

df = load("big.csv")              # default: plain pandas (NumPy dtypes)
df = load("big.csv", fast=True)   # Arrow-accelerated: much faster, less memory

fast=True delegates to pyarrow's multi-threaded C++ parser for CSV and JSON-lines and returns Arrow-backed columns (dtype_backend="pyarrow") for every format — typically several times faster with a fraction of the memory, and no slow object dtype. The default stays plain pandas for backwards compatibility. Any explicit reader kwargs you pass override the fast defaults.

Installing loadfile[calamine] (or [all]) additionally enables the fast Rust calamine engine for Excel under fast=True.

Format override and reader options

Any extra keyword arguments are forwarded to the underlying pandas reader:

load("export.tsv", format="csv", sep="\t")
load("book.xlsx", sheet_name="Sheet2")
load("big.csv", usecols=["id", "value"])

Credentials

Pass backend options via storage_options (forwarded to fsspec):

load("gs://bucket/data.parquet", storage_options={"token": "/path/key.json"})
load("s3://bucket/data.csv", storage_options={"key": "...", "secret": "..."})

ZIP archives

A .zip may contain any mix of supported formats. Each member is loaded with the reader matching its own extension.

# Single data file in the zip -> a DataFrame
df = load("archive.zip")

# Multiple data files -> a dict {member_name: DataFrame}
frames = load("archive.zip")               # {"a.csv": ..., "b.parquet": ...}

# Pick one member -> a DataFrame
df = load("archive.zip", filename="a.csv")

# Pick a subset -> a dict of just those members
frames = load("archive.zip", filename=["a.csv", "b.parquet"])

Non-data members (e.g. readme.txt) and nested zips are ignored. A zip with no supported files raises EmptyArchiveError; a missing requested member raises MemberNotFoundError.

Development

pip install -e ".[dev,all]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loadfile-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loadfile-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file loadfile-0.1.1.tar.gz.

File metadata

  • Download URL: loadfile-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loadfile-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be271d38fd236bbf596db5fd4d2b88de2744b461b25c73786ceb09840b63bca5
MD5 bcb8336a18da57455d3d93081b5e74db
BLAKE2b-256 cb3b1b9491a2ecaca8b8d28675700445cfd810283da6f3edb6d4ecb9e99383df

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfile-0.1.1.tar.gz:

Publisher: publish.yml on VedantAndhale/loadfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file loadfile-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: loadfile-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loadfile-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf130b212d3934f2dec07929de5f00ddf51f8f99342c9a480204a15956d8c15
MD5 4e973f3ba571b30004e0f42d3e740275
BLAKE2b-256 8a4446ad98a15c3fc08e480bed25b3dc7c7cf5a5cd9ee122737ac87b520aec99

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfile-0.1.1-py3-none-any.whl:

Publisher: publish.yml on VedantAndhale/loadfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page