Answers for "panda series get index"

5

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]
Posted by: Guest on September-18-2020
0

pandas print index

# Import pandas package  
import pandas as pd  
    
# making data frame  
data = pd.read_csv("data.csv")  
  
print(data.index)
Posted by: Guest on April-19-2020
1

how to get index of pandas dataframe python

DataFrame.index
Posted by: Guest on August-05-2021
1

how to get index of pandas dataframe python

import pandas as pd

df = pd.DataFrame(
    [[88, 72, 67],
    [23, 78, 62],
    [55, 54, 76]],
    index=[2, 4, 9],
    columns=['a', 'b', 'c'])

index = df.index
print(index)
Posted by: Guest on August-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language