Retaining categorical dtype upon dataframe concatenation

后端 未结 3 1307
谎友^
谎友^ 2020-12-16 16:29

I have two dataframes with identical column names and dtypes, similar to the following:

A             object
B             category
C             category
         


        
3条回答
  •  臣服心动
    2020-12-16 16:50

    JohnE's answer is helpful, but in pandas 0.19.2, union_categoricals can only be imported as follow: from pandas.types.concat import union_categoricals

提交回复
热议问题