Utilities to read/write python objects to/from dropbox
Project description
vdropbox
Utilities to read/write objects to/from dropbox
Usage
The first thing to do is to declare the Vdropbox
object using a token with:
from vdropbox import Vdropbox
vdp = Vdropbox("my_secret")
Unlike the official dropbox
python package it is not needed to have a leading /
in all names.
Basic functions
# Check if a file exists
vdp.file_exists("my_file.txt")
vdp.file_exists("folder/my_file.txt")
# Check contents of a foler
vdp.ls("my_folder")
# Delete a file
vdp.delete("my_file.txt")
Reading and writting text files
data = "Hello world"
# Write a text file
vdp.write_file(data, "my_file.txt")
# Read a text file
vdp.read_file("my_file.txt")
Internally it is using
oyaml
so all yamls are ordered.
Reading and writting yamls
data = {"a": 4, "b": 2}
# Write a yaml file
vdp.write_yaml(data, "my_file.yaml")
# Read a yaml file
vdp.read_yaml("my_file.yaml")
Internally it is using
oyaml
so all yamls are ordered.
Reading and writting excels with pandas
import pandas as pd
# Dummy dataframe
df = pd.DataFrame(list("ABCDE"), columns=["col"])
# Write an excel file
vdp.write_excel(df, "df.xlsx")
# Read a parquet file
vdp.read_excel("df.parquet")
It is possible to pass keyworded arguments to the internal pd.read_excel
or df.to_excel
function.
For example:
vdp.write_excel(df, "test.xlsx", index=False)
Reading and writting parquets with pandas
import pandas as pd
# Dummy dataframe
df = pd.DataFrame(list("ABCDE"), columns=["col"])
# Write a parquet file
vdp.write_parquet(df, "df.parquet")
# Read a parquet file
vdp.read_parquet("df.parquet")
It is possible to pass keyworded arguments to the internal pd.read_parquet
or df.to_parquet
function.
Authors
License
The content of this repository is licensed under a MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vdropbox-0.2.7.tar.gz
.
File metadata
- Download URL: vdropbox-0.2.7.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.7.12 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0296a3d8935326586b9df65a93ee3e04da2fe2ce158d6f45127b00189874a20 |
|
MD5 | 13e9a33c7277f424b03b56b1dedb5421 |
|
BLAKE2b-256 | 4a46acad177344b7cc8142c0d4f3b63993fc393496d5f184543504879036acbe |
File details
Details for the file vdropbox-0.2.7-py3-none-any.whl
.
File metadata
- Download URL: vdropbox-0.2.7-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.7.12 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7190ad7276ff10272bdf45133143efcea461fd28166f396e46eeff62343f8da4 |
|
MD5 | 6dba527439534f8cc5ff56d1a85417f5 |
|
BLAKE2b-256 | 179286294bd87f918d8dc38fbcd21f1ad6c5b06165d5cd6594a2e2d18b1c7029 |