In order to subset columns based on whether they contain a particular string, we can use the filter()
method and provide a like
argument with the string. Here is an example:
main.py381 chars17 lines
This will output:
main.py73 chars5 lines
In this example, the filter()
method looks for columns that contain the string 'data', and returns a new dataframe with only those columns (job_title
, in this case).
gistlibby LogSnag