Skip to content

crunchdao/readwrite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quickly read and write file based on their extension.

PyTest

Install

python3 -m pip install --upgrade readwrite

CLI Usage

readf [FILE-PATHS...]

or

readfile <EXTENSION> [EXTENSION-SPECIFIC-OPTIONS] [FILE-PATHS...]

Code Usage

import readwrite as rw

# will use pandas.read_csv(...)
df = rw.read("data.csv")

# will use pandas.to_parquet(...)
rw.write(df, "data.parquet")

Supported Extensions

Handler Extensions Backend Read Write
Binary bin Python's bytes ✔️ ✔️
Csv csv pandas ✔️ ✔️
Excel xlsx pandas ✔️ ✔️
Joblib joblib joblib ✔️ ✔️
Json json Python's json ✔️ ✔️
Parquet parquet pandas ✔️ ✔️
Pickle pkl, pickle Python's pickle or pandas ✔️ ✔️
Toml toml toml ✔️ ✔️
Tar tar Python's tarfile ✔️
Text txt Python's str ✔️ ✔️
Yaml yml, yaml PyYAML ✔️ ✔️
Zip zip Python's zipfile ✔️