Quickly read and write file based on their extension.
python3 -m pip install --upgrade readwrite
readf [FILE-PATHS...]
or
readfile <EXTENSION> [EXTENSION-SPECIFIC-OPTIONS] [FILE-PATHS...]
import readwrite as rw
# will use pandas.read_csv(...)
df = rw.read("data.csv")
# will use pandas.to_parquet(...)
rw.write(df, "data.parquet")
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 |
✔️ | ❌ |