Skip to content

Instantly share code, notes, and snippets.

@MaxHalford
Created July 26, 2017 10:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save MaxHalford/f17994c77bb775fdd04c9cd925e0b279 to your computer and use it in GitHub Desktop.
Save MaxHalford/f17994c77bb775fdd04c9cd925e0b279 to your computer and use it in GitHub Desktop.
Save a pandas.DataFrame to Dropbox
import dropbox
def to_dropbox(dataframe, path, token):
dbx = dropbox.Dropbox(token)
df_string = dataframe.to_csv(index=False)
db_bytes = bytes(df_string, 'utf8')
dbx.files_upload(
f=db_bytes,
path=path,
mode=dropbox.files.WriteMode.overwrite
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment