“Создать DF из списка DICTS” Ответ

DataFrame для списка DICTS

df = pd.DataFrame({'Name': ['John', 'Sara','Peter','Cecilia'],
                   'Age': [38, 47,63,28],
                  'City':['Boston', 'Charlotte','London','Memphis']})

datadict = df.to_dict('records')
Exuberant Eland

Создать DF из списка DICTS

# Python code demonstrate how to create  
# Pandas DataFrame by lists of dicts. 
import pandas as pd 
    
# Initialise data to lists. 
data = [{'Geeks': 'dataframe', 'For': 'using', 'geeks': 'list'},
        {'Geeks':10, 'For': 20, 'geeks': 30}] 
    
# Creates DataFrame. 
df = pd.DataFrame(data) 
    
# Print the data 
df
Real Raccoon

Список DICT Python к DataFrame

# Supposing d is your list of dicts, simply
df = pd.DataFrame(d)
# Note: this does not work with nested data
Arno Deceuninck

Список дикта DF

df = pd.DataFrame(d)  #here d is list of dict 
Sachin

Ответы похожие на “Создать DF из списка DICTS”

Вопросы похожие на “Создать DF из списка DICTS”

Смотреть популярные ответы по языку

Смотреть другие языки программирования