table2dataframe

table2dataframe(t) converts a mathlayer® table t into a python pandas dataframe.

Examples

>> Name = {'John';'Marc';'Sam';'Toni'}
Grades = {'B';'A';'B';'F'}
DOB = {'02-Jun-2012';'12-Feb-2012';'04-Oct-2011';'29-Aug-2012'}
T = table(Name,Grades,DOB,'VariableNames',{'First_Name' 'Grade' 'Date_birth'})#

 First_Name Grade   Date_birth 
       John     B  02-Jun-2012 
       Marc     A  12-Feb-2012 
        Sam     B  04-Oct-2011 
       Toni     F  29-Aug-2012 

>> df = table2dataframe(T)#

{
	"First_Name": ["John", "Marc", "Sam", "Toni"], 
	"Grade": ["B", "A", "B", "F"], 
	"Date_birth": ["02-Jun-2012", "12-Feb-2012", "04-Oct-2011", "29-Aug-2012"]
}
	   
>> T.RowNames = {'a1'; 'a2'; 'a3'; 'a4'} 

% add row names to label index

df = table2dataframe(T)# { "First_Name": ["John", "Marc", "Sam", "Toni"], "Grade": ["B", "A", "B", "F"], "Date_birth": ["02-Jun-2012", "12-Feb-2012", "04-Oct-2011", "29-Aug-2012"] }, index = ["a1","a2","a3","a4"]

References

Pandas dataframe

See also

json | table2json | table