read specific line based on column value csv in python

main.py
import pandas as pd

# Load the CSV file into a DataFrame
df = pd.read_csv('file.csv')

# Find the specific line where column 'columnName' has a certain value
specific_line = df.loc[df['columnName'] == 'desiredValue']

print(specific_line)
240 chars
10 lines

related categories

gistlibby LogSnag