0

I'm parsing a large excel sheet for specific strings found in one column and need to export those rows found to a new sheet.

I've done the following: Selected the file BigExcel = r"path to file"

Created dataframe df=pd.read_excel(BigExcel)

Selected rows with a specific string in a specific column df[df["ModuleAndEventText'].str.contains("prtest3")]

Aaaaand now I don't know how to move that output to a new excel or csv file

  • `df[df["ModuleAndEventText'].str.contains("prtest3")].to_csv(...)` or `df[df["ModuleAndEventText'].str.contains("prtest3")].to_excel(...)` – BigBen Jun 12 '23 at 13:52
  • Thanks for the assistance BigBen, but when I append .to_excel(path to file) I'm getting OSError: [Errno 22] Invalid argument: 'C:\path to file\file.xlsx' Unfortunately I get the same error when trying it as a CSV. – kayaker Jun 12 '23 at 15:35
  • Put `r` in front of the string. – BigBen Jun 12 '23 at 15:36

0 Answers0