-1

I am an amateur user. I watched many videos but I couldn't figure out this error.

Code

How can I keep PERSON_WGHT, LOS, and IDC_DC_CD_1 as a columns for all rows that is 386816.

Progman
  • 16,827
  • 6
  • 33
  • 48
Black-Cat
  • 1
  • 2
  • `df.loc[:, ['PERSON_WGHT', 'LOS', 'IDC_DC_CD_1']]` – ScottC Jan 01 '23 at 15:32
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see which questions are on-topic on this site. [Please do not upload images of code/errors when asking a question.](https://meta.stackoverflow.com/q/285551) – Progman Jan 01 '23 at 15:47

1 Answers1

0

If you need to select multip0le columns from all the records then use df[[column_list]].

df_new = df[['PERSON_WGHT', 'LOS', 'IDC_DC_CD_1']]