Assign values from a dataframe to another dataframe based on a Boolean mask
I have a large pandas dataframe consisting of 18 columns and 20000 rows. I want to copy 4 of its columns over to a new dataframe for data output to a file, based on the value of a 5th column. I have created a mask (as advised in How do I select rows from a DataFrame based on column values?):