Example 1: from list of lists to dataframe
import pandas as pd
data = [['New York Yankees', 'Acevedo Juan', 900000, 'Pitcher'],
['New York Yankees', 'Anderson Jason', 300000, 'Pitcher'],
['New York Yankees', 'Clemens Roger', 10100000, 'Pitcher'],
['New York Yankees', 'Contreras Jose', 5500000, 'Pitcher']]
df = pd.DataFrame.from_records(data)
Example 2: python how to Create Pandas Dataframe from Multiple Lists
import pandas as pd
months = ['Jan','Apr','Mar','June']
days = [31, 30, 31, 30]
intermediate_dictionary = {'Month':months, 'Day':days}
pandas_dataframe = pd.DataFrame(intermediate_dictionary)
print(pandas_dataframe)
Month Day
0 Jan 31
1 Apr 30
2 Mar 31
3 June 30
Example 3: pandas list to df
import pandas as pd
lst = ['Geeks', 'For', 'Geeks', 'is',
'portal', 'for', 'Geeks']
df = pd.DataFrame(lst)
df
Example 4: how to create a dataframe from two lists in python
data_tuples = list(zip(Month,Days))
data_tuples
[('Jan', 31), ('Apr', 30), ('Mar', 31), ('June', 30)]
>pd.DataFrame(data_tuples, columns=['Month','Day'])
Month Day
0 Jan 31
1 Apr 30
2 Mar 31
3 June 30
Example 5: pandas create dataframe from list of lists
import pandas as pd
data = [['tom', 10], ['nick', 15], ['juli', 14]]
df = pd.DataFrame(data, columns = ['Name', 'Age'])
df