Skip to content

Instantly share code, notes, and snippets.

@patharanordev
Created October 6, 2020 16:09
Show Gist options
  • Save patharanordev/f68886d1007938bfe49e460129c477de to your computer and use it in GitHub Desktop.
Save patharanordev/f68886d1007938bfe49e460129c477de to your computer and use it in GitHub Desktop.
Write DataFrame from pandas to CSV file
production_fname = '{}/production.csv'.format(os.getcwd())
def write_prodfile(production_df):
if os.path.isfile(production_fname):
# Remove if exists
os.remove(production_fname)
production_df.to_csv(r'{}'.format(production_fname), index = False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment