Make a copy of a select columns of a dataframe

PHOTO EMBED

Fri Oct 21 2022 18:41:15 GMT+0000 (Coordinated Universal Time)

Saved by @DiegoEraso #python

# Opcion 1, select column index: 1,2,3

new = old.iloc[:,[1,2,3]].copy()

# Opcion 2, do not forget the double square breaks 

new = old[['a','b','c']].copy

content_copyCOPY

https://stackoverflow.com/questions/34682828/extracting-specific-selected-columns-to-new-dataframe-as-a-copy