Package: pydatatable
pydatatable v1.2Python Library to create graphical table from the data and is with auto update feature!pydatatableis a Python library made to display graphical tables from the given data.Introductionpydatatableis a Python library made to display graphical tables from given data. It can create a graphical table
in the form of a '.html' file. This library is made by Siddhesh Chavan(me). The table can even self update itself if you
enable it.InstallationTo install the library type:pip insall pydatatablein the command prompt.Import StatementTypeimport pydatatableto import it after installation.Creating a Simple TableTo create a simple table, type:importpydatatableastabletable1=table.Table(location='table_test',title='Simple Table')# Create a Table object.all_data=[[1,1,1],[2,2,2]]# Define the 'all_data' list.title=['Title1','Title2','Title3']# Define the 'title' list.table1.add_data(data=all_data,columns=title)# Add data to the table.table1.open()# Automatically open the table.The above program will save a '.html' file in the given location. It will open a '.html' document as shown below:The Table ClassThe Table class contains many features:Parameters:The Table class's parameters:location--> The path to save the table.title--> The title of the table.table_border--> The boder of the table in integer format.border_color--> The boder colour of the table in string format like 'red', 'black', 'green', etc. and you can
also use hexadecimal values as '#ff0000'cell_padding--> The space between the individual cell contents and the cell border. Use the value in integer
format.cell_spacing-> The space between the cell border and the table border. Use the value in integer format.cell_horizontal_text_align--> The horizontal text align of the text in each cell. Use values like 'center', '
left', 'right'.cell_vertical_text_align--> The vertical text align of the text in each cell. Use values like 'middle', '
top', 'bottom'.column_bg_color--> The background colour of the columns in the table. Use any color or the hexadecimal value in
string format.data_bg_color--> The background colour of the data in the table. Use any color or the hexadecimal value in
string format.column_text_color--> The text colour of the text in columns.data_text_color--> The text colour of the text in the data rows.print_log--> Set it toTrueif you want the table making log to be printed out on the console.font--> The font of the table.Use above parameters like:importpydatatableastabletable1=table.Table(location='test_table',title='Table',table_border=5,border_color='Black',cell_padding=3,cell_spacing=0,cell_horizontal_text_align='center',cell_vertical_text_align='middle',column_bg_color='Yellow',data_bg_color='White',column_text_color='Black',data_text_color='Black',print_log=False)# Create a Table object.all_data=[[1,1,1],[2,2,2]]# Define the 'all_data' list.title=['Title1','Title2','Title3']# Define the 'title' list.table1.add_data(data=all_data,columns=title)# Add data to the table.table1.open()# Automatically open the table.Functions:1. add_data(data, columns)Function to add the data to the table.Thedatashould have a nested list with all the data. For example,data=[[1,1,1],[2,2,2]]Thecolumnsshould have a list of all columns to be showed in the table. For
example,columns=['Title1','Title2','Title3']The length of the nested list, data, should be equal to the data in the columns as shown in the above example.2. enable_auto_update(time=5000)Function to enable auto update the table.Thetimeshould be in milliseconds and integer format. It is the time after which the table is updated.3.disable_auto_update()Function to disable auto update.4.update_data(data, append=False, wait=True)Function to update the data.Remember to call this function in a loopThedatais the nested list of the data to be updated.If you want to append the new data to the previous data then set append toTrueelseFalseIf you want your program to wait for the given auto update time and run again then the setwaittoTrue,
if not thenFalseFor Example,importpydatatableastableimportrandomtable1=table.Table('table')table1.add_data([[0,0,0]],['1','2','3'])table1.enable_auto_update()table1.open()i=3whileTrue:one=random.randint(0,99999)two=random.randint(0,99999)three=random.randint(0,99999)table1.update_data(data=[[one,two,three]],append=True,wait=True)i+=1The above program will create and update the table by random values.Make sure to call the 'enable_auto_update()'
function before the 'open()' function.5.open()Function to open the saved table automatically.6.print_settings()Function to print the table's settings in the console.Creating Multiple Tables on one pageTo create multiple tables on one page, use theMultipleTablesclass. For Example,importpydatatableastableimportrandomimporttimetable1=table.Table('table')table1.add_data([[0,0,0]],['1','2','3'])table1.enable_auto_update()table2=table.Table('table2')table2.add_data([[0,0,0]],['1','2','3'])table2.enable_auto_update()multiple_table=table.MultipleTables('chart','All Types',height=600,width=700)multiple_table.add_table(['table.html','table2.html'])multiple_table.open()i=3whileTrue:one=random.randint(0,99999)two=random.randint(0,99999)three=random.randint(0,99999)table1.update_data(data=[[one,two,three]],append=True,wait=False)table2.update_data(data=[[one,two,three]],append=True,wait=False)time.sleep(5)i+=1Usewait=Falseif you want to update both the tables at the same time but also usetime.sleep()function
otherwise the table will not be displayed. Check the above program.The above output is:The MultipleTables ClassThe MultipleTables class contains many features:Parameters:location--> The location of the '.html' page to be saved.title--> The title of group of tables.height--> The height of all frames.width--> The width of all frames.frame_border--> The frame border of all frames.border--> The border width of all frames.border_color--> The border color of all frames.Functions:1. add_table(table_locations, frame_value=[], frame_size=[])Function to add the saved tables on one page.table_locations--> The list of all the line's saved locations to be added on one page. The elements should be
separated by commas and should be in 'string' format. Please give the correct location along with the extension. The
order of charts in the page is same as the order of files given in the list. You can change the values in the list to
add the charts accordingly.frame_value--> If you want to change the size of one table in a page then give the table's list index according
to the 'table_locations' list and use the frame_size parameter to set a different size for that specified table.frame_size--> If you pass the 'frame_size' parameter, then give the size of that table in a 2-d list. First is
height and then width.2. open()Function to open the saved multiple charts.3. print_settings()Function to print the table settings.Thank you for installing this module!