How do I Pass a List of Series to a Pandas DataFrame?

后端 未结 6 2119
栀梦
栀梦 2021-02-03 23:57

I realize Dataframe takes a map of {\'series_name\':Series(data, index)}. However, it automatically sorts that map even if the map is an OrderedDict().

Is there a simpl

6条回答
  •  忘掉有多难
    2021-02-04 01:00

    You can first create an empty DataFrame and then use append() to it.

    df = pd.DataFrame()
    

    then:

    df = df.append(list_series)
    

    I also like to make sure the previous script that created list_series won't mess my dataframe up:

    df.drop_duplicates(inplace=True)
    

提交回复
热议问题