Answers for "pd dataframe from list of lists"

0

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)
Posted by: Guest on June-04-2020
0

dataframe to list of lists

>>> df = pd.DataFrame([[1,2,3],[3,4,5]])
>>> lol = df.values.tolist()
>>> lol
[[1L, 2L, 3L], [3L, 4L, 5L]]
Posted by: Guest on December-08-2021
0

pd dataframe from list of lists

Creating Pandas dataframe using list of lists ; df = pd.DataFrame(data, columns = [ 'Name' , 'Age' ])
Posted by: Guest on April-03-2022

Code answers related to "pd dataframe from list of lists"

Browse Popular Code Answers by Language