Skip to main content

How to input specific row value, with row number output

I've struggled with understanding functions and the task that I am trying to accomplish is creating a function that takes the input from a row-value and outputs the row number.

An example dataset

import pandas as pd
 
data = [['tom', 10], ['nick', 15], ['juli', 14]]

df = pd.DataFrame(data, columns=['Name', 'Age'])

The hope is that I can call any name using a function and the output would be the row number.

Example of what I'm looking for is using the input - "Nick", output would be 1.



source https://stackoverflow.com/questions/72757343/how-to-input-specific-row-value-with-row-number-output

Comments