0

I have a data frame with a column titled 'Post Type'.

If the value in this column is 1, the post type is a question. If the value in this column is 2, the post type is an answer.

How can I return 2 new dataframes, one for questions and one for answers?

maxwell7
  • 11
  • 2

1 Answers1

0
question_df = df[df["Post Type"] == 1]
answer_df = df[df["Post Type"] == 2]

Please refer filter-specific-rows-from-a-dataframe

Azhar Khan
  • 3,829
  • 11
  • 26
  • 32