Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dataframe slice by list of values

In [1]: df = pd.DataFrame({'A': [5,6,3,4], 'B': [1,2,3,5]})

In [2]: df
Out[2]:
   A  B
0  5  1
1  6  2
2  3  3
3  4  5

In [3]: df[df['A'].isin([3, 6])]
Out[3]:
   A  B
1  6  2
2  3  3
Comment

dataframe slice by list of values

In [4]: df[~df['A'].isin([3, 6])]
Out[4]:
   A  B
0  5  1
3  4  5
Comment

PREVIOUS NEXT
Code Example
Python :: complex phase python 
Python :: matplotlib add space between subplots 
Python :: renomear colunas pandas 
Python :: remove unicode characters from string python 
Python :: open choose files from file explorer python 
Python :: python current date and time 
Python :: créer des variable dynamiques python 
Python :: django-admin command not found 
Python :: python print to file 
Python :: matplotlib plot two graphs side by side 
Python :: python install required packages 
Python :: how to read from a file into a list in python 
Python :: grid in pygame 
Python :: chromebook install pip 
Python :: utf8 python encodage line 
Python :: blender python set object location 
Python :: python blender select object by name 
Python :: csv to numpy array 
Python :: python pendas shut off FutureWarning 
Python :: django python base 64 encode 
Python :: django form password field 
Python :: python server http one line 
Python :: python check ram usage 
Python :: r2 score sklearn 
Python :: Connecting Kaggle to Google Colab 
Python :: how to save a model fast ai 
Python :: how to apply logarithm in pandas dataframe 
Python :: 1 eth to wei 
Python :: how to get variable from setings django 
Python :: upload file in colab 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =