Pandas scatter_matrix - plot categorical variables

后端 未结 3 941
谎友^
谎友^ 2021-02-09 05:19

I am looking at the famous Titanic dataset from the Kaggle competition found here: http://www.kaggle.com/c/titanic-gettingStarted/data

I have loaded and processed the da

3条回答
  •  日久生厌
    2021-02-09 05:45

    Here is my solution:

    # convert string column to category
    df.Sex = df.Sex.astype('category')
    # create additional column for its codes
    df['Sex_code'] = df_clean.Sex.cat.codes
    

提交回复
热议问题