Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python loc id in list

In [30]: df = pd.DataFrame({'subscriber_id':[1,2,3,4,5]})
'''   	subscriber_id
	0              1
	1              2
	2              3
	3              4
	4              5 '''

mask = df['subscriber_id'].isin([2,4,5])
''' 0    False
	1     True
	2    False
	3     True
	4     True '''

df.loc[mask]
'''	   subscriber_id
	1              2
	3              4
	4              5 '''
Comment

PREVIOUS NEXT
Code Example
Python :: talib 
Python :: Use of OfficeApi 
Python :: How to make exit button? 
Python :: how to ge squrre root symobl as string inpython 
Python :: how to execute more than one line of code in one line python 
Python :: how to know google index of a page using python 
Python :: sympy.diff 
Python :: pandas count zeros in column 
Python :: how to split string into list conditionally+python 
Python :: create new column pandas and order sequence 
Python :: how to threshold filter geodataframe by column value 
Python :: python class overwrite length method 
Python :: Three-dimensional Contour Plots 
Python :: jupter notebook save session variables 
Python :: how to shorten turtle. to t. 
Python :: python multilevel list comprehension 
Python :: how to add multiple commands to tkinter button 
Python :: how to incorportate a different language in python code 
Python :: vs code notes extension 
Python :: code suggestion html not working in django-html 
Python :: python geodata visualize 
Python :: fill missing values with meadian in df 
Python :: remove exif from image 
Python :: smallest string with a given numeric value 
Python :: import all files on the same directory python 
Python :: how to remove all line in file python 
Python :: login() takes 1 positional argument but 2 were given 
Python :: how to connect presto from python 
Python :: How to separate characters, Numbers and Special characters from given string with python 
Python :: python c api 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =