Skip to content

Custom functions to save pandas dataframes as nicely formatted tables into a text file, and vice versa.

License

Notifications You must be signed in to change notification settings

antoineallard/pandas-fancy-table-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Input/output fancy tables with Pandas

Custom functions to save pandas dataframes as nicely formatted tables into a text file, and vice versa.

Usage

import pandas
from pandas_fancy_table_io import to_fancy_table, from_fancy_table

# Adds the custom functions to the pandas module.
pandas.DataFrame.to_fancy_table = to_fancy_table
pandas.from_fancy_table = from_fancy_table

# Creates a dataframe.
details = {
    'Name' : ['Ankit', 'Aishwarya', 'Shaurya', 'Shivangi'],
    'Age' : [23, 21, 22, 21],
    'University' : ['BHU', 'JNU', 'DU', 'BHU']
}
df1 = pandas.DataFrame(details)

# Writes the dataframe into a text file.
df1.to_fancy_table('table_test.txt')

# Reads the dataframe from the texte file.
df2 = pandas.from_fancy_table('table_test.txt')

See pandas_fancy_table_io.py and example.py for further details.

About

Custom functions to save pandas dataframes as nicely formatted tables into a text file, and vice versa.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages