Skip to content

Instantly share code, notes, and snippets.

@Rajan-sust
Created October 22, 2019 17:14
Show Gist options
  • Save Rajan-sust/0aae51e88e8d6b665e6c2126ab771798 to your computer and use it in GitHub Desktop.
Save Rajan-sust/0aae51e88e8d6b665e6c2126ab771798 to your computer and use it in GitHub Desktop.
Saving dataframe as a tsv file format
# Import pandas library
import pandas as pd
# initialize list of lists
data = [['tom', 10], ['nick', 15], ['juli', 14]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age'])
df.to_csv('filename.tsv', sep = '\t', encoding='utf-8', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment