Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas columns starting with

In [28]:

filter_col = [col for col in df if col.startswith('foo')]
filter_col
Out[28]:
['foo.aa', 'foo.bars', 'foo.fighters', 'foo.fox', 'foo.manchu']
In [29]:

df[filter_col]
Out[29]:
   foo.aa  foo.bars  foo.fighters  foo.fox foo.manchu
0     1.0         0             0        2         NA
1     2.1         0             1        4          0
2     NaN         0           NaN        1          0
3     4.7         0             0        0          0
4     5.6         0             0        0          0
5     6.8         1             0        5          0
Comment

PREVIOUS NEXT
Code Example
Python :: python reference script directory 
Python :: fibonacci series python recursion 
Python :: python remove empty string from list 
Python :: --disable warning pytest 
Python :: python loop through directory 
Python :: filter by row contains pandas 
Python :: save model pickle 
Python :: how to move a button lower on a gui tkinter 
Python :: html to json python 
Python :: lcm math python library 
Python :: jupyter notebook pass python variable to shell 
Python :: read database pandas 
Python :: seaborn pairplot label rotation 
Python :: python turtle line thickness 
Python :: install flake8 python 
Python :: set icon title tkinter 
Python :: python print dict pretty 
Python :: matrix pow python 
Python :: python beautifulsoup write to file 
Python :: name unnamed column pandas 
Python :: how to open local html file in python 
Python :: python create nested directory 
Python :: how to get all links text from a website python beautifulsoup 
Python :: how to create migrations in django 
Python :: How to update python using anaconda/conda 
Python :: how to print numbers from 1 to 20 in python 
Python :: python -m pip install --upgrade 
Python :: NotImplementedError: Please use HDF reader for matlab v7.3 files 
Python :: AssertionError: Relational field must provide a `queryset` argument, override `get_queryset`, or set read_only=`True` 
Python :: datetime 30 days ago python 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =