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[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

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.0.tar.gz (9.4 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.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loadfile-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 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.0.tar.gz
Algorithm Hash digest
SHA256 c778fe64f8228c70ac5decff510a52cb835a0e61d6f529e4030489948243f7fe
MD5 b54c24944e603665549f425dcdcba580
BLAKE2b-256 2114d9386dea07cf837eb0ade32b782be11abb0983e33908a427e851ac994da4

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfile-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: loadfile-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2344e204e66484b153a4576c2cec1c586809dc63e69594dc6089a602355dd121
MD5 f78c0431b73fea09eed8cd2a9e1376cc
BLAKE2b-256 7cebc6a09e2b50d29020de47d3113cf8c9c76496dc1ca41344ef87287ee657a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfile-0.1.0-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