using python how to find a element and print its index of csv file

时间:2019-05-31 11:54:13

标签: python-3.x

I have a csv file with below matrix like information. By giving it as a input in that there is a element -1. I need a code to find the index of -1. Please help me in this. The below data is the csv file input to python:

img

1 个答案:

答案 0 :(得分:0)

尝试一下:

import pandas as pd
csv = pd.read_csv(r'C:/.../file.csv', ';')
index = []

for i,r in csv.iterrows():
      index.append(i)

print(index[-1])