Pandas column separation using .loc

Question:

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.

Asked By: Black-Cat

||

Answers:

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']]
Answered By: Rajkumar Hajgude
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.