Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

finding the index of an element in a pandas df

In [48]: a
Out[48]: 
   c1  c2
0   0   1
1   2   3
2   4   5
3   6   7
4   8   9

In [49]: a.c1[a.c1 == 8].index.tolist()
Out[49]: [4]
Comment

finding the index of an item in a pandas df

print(df[df['Name']=='Donna'].index.values)
Comment

pandas series index of value

>>> myseries[myseries == 7]
3    7
dtype: int64
>>> myseries[myseries == 7].index[0]
3
Comment

get index number pandas dataframe

df.index[df['BoolCol'] == True].tolist()
Comment

get index of dataframe

df.index
Comment

PREVIOUS NEXT
Code Example
Python :: equivalent of setInterval python 
Python :: get dictionary in array python by value 
Python :: remove nan particular column pandas 
Python :: create a dataframe with series 
Python :: show pythonpath 
Python :: converting bool to 1 if it has true and if it is false print 1 
Python :: new working version of linkchecker 
Python :: pandas dataframe rename column 
Python :: how to change dtype object to int 
Python :: pyautogui install 
Python :: pytest installation windows 
Python :: matplotlib bold 
Python :: panda read data file 
Python :: python alphabet string 
Python :: how to add card using py-trello API 
Python :: ssl unverified certificate python 
Python :: python split dict into chunks 
Python :: python set label colour 
Python :: cv2.adaptiveThreshold() python 
Python :: standard module 
Python :: table python 
Python :: take two numbers as inout in single line in python 
Python :: how to save a dictionary as a file in python 
Python :: pathlib recursive search 
Python :: python program to multiplies all the items in a list using function 
Python :: how to calculate mean in python 
Python :: rerun file after change python 
Python :: python check disk space 
Python :: python every other goes to a list 
Python :: create django user command line 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =