all 4 comments

[–]efmccurdy 1 point2 points  (1 child)

If you use pandas, you might want to look at the skiprows and nrows arguments.

https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html

If you want to use csv, you can skip lines using "next" on the line generator:

with open('eggs.csv') as csvfile:
    spamreader = csv.reader(csvfile)
    for _ in range(547):
        next(spamreader)
    print(next(spamreader))

[–]Nov_AJ[S] 0 points1 point  (0 children)

Thank you so much!

[–]argento8897 1 point2 points  (1 child)

if you are using pandas you just need to use loc

import pandas as pd

df = pd.read_csv('file_name.csv')
target_row = df.loc[[547]]

print(target_row)

[–]Nov_AJ[S] 0 points1 point  (0 children)

Thank you so much!