79343629

Date: 2025-01-09 18:12:16
Score: 2
Natty:
Report link

Assuming you know the text content you wish to match in the first column and extract just that row, you should be able to do the following using Pandas and four lines of code.

The property pandas.DataFrame.loc allows you to, "Access a group of rows and columns by label(s) or a boolean array."

See: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.loc.html#pandas-dataframe-loc

import pandas as pd

filename = "big.csv"
df = pd.read_csv(filename)

"""Search the CSV file by a column called 'column name' for any rows containing
your 'DataName' or 'DataValues' and return those specific rows.
"""
specific_rows = df.loc[
    (df['column name'] == 'DataName') | (df['column name'] == 'DataValues')
]

Does that help you?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Luke