How do I convert a list of objects to a pandas dataframe?
class Person(object):
def __init__(self):
self.name = ""
self.year = 0
self.salary = 0
For example below works but I want to have a list of person classes instead
import pandas as pd
import numpy as np
data = {'name': ['Alice', 'Bob', 'Charles', 'David', 'Eric'],
'year': [2017, 2017, 2017, 2017, 2017],
'salary': [40000, 24000, 31000, 20000, 30000]}
df = pd.DataFrame(data, index = ['Acme', 'Acme', 'Bilbao', 'Bilbao', 'Bilbao'])
print(df)