How do I find the value of a row of a column with the value of a variable?

Viewed 25

doing it this way and printing the value of "row_x" prints the value of row 1 of a csv file

fila = 1
vueltas = 0

fila_x = ejes_df.loc[ejes_df['Variable'].isin([1])]

but when I want to indicate the value of the row through the value of a variable "row = 1" it does not seem to work, when printing it only the name of the variable "row_x" appears

fila = 1
vueltas = 0

fila_x = ejes_df.loc[ejes_df['Variable'].isin([fila])] 

What could I do to make it work? Is there another way to do it in which the value of the variable can be used to indicate the value of the row? to read csv file i am using pandas

1 Answers

ok I found the error, I think it was because when changing the value of the row I was only running that line of code, instead of running the line of code where the variable "row" was given the value of 1, that is why the function did not find that value ‍♀️

Related