Pandas DataFrame From Dict | pd.DataFrame.from dict()

Опубликовано: 26 Июль 2020
на канале: Greg Kamradt
3,168
41

http://dataindependent.com/pandas/pan...

You can create a DataFrame many different ways. One popular way to do it is creating a pandas DataFrame from dict, or from a dictionary.

There are two main ways to create a DataFrame from a dictionary, using orient=columns or orient=index. Orient is short for orientation, or, a way to specify how your data is laid out.

Method 1 - Orient (default): columns = If you want the keys of your dictionary to be the DataFrame column names
Method 2 - Orient: index = If the keys of your dictionary should be the index values. You'll need to be explicit about column names.