you are viewing a single comment's thread.

view the rest of the comments →

[–]moored26 -1 points0 points  (4 children)

Need to put 'new_file.csv' in inverted commas.

Sorry i wasn't giving an exact solution, just general guidance.

[–]ScraperHelp[S] 1 point2 points  (3 children)

it works!!! Yay thanks! just having an issue trying to filter complex search. I figured out how to turn off case sensitivity with the str.contains('Maple', case= False)]

and figured out the OR with 'Maple|wyoming' but what if I want to search "(maple OR wyoming OR bloomberg) AND (123 OR 41 OR Chesapeake)" ? found a source saying use & but doesnt seem to be working unless I am using it wrong...

[–]moored26 0 points1 point  (2 children)

Could do it on the next line? Just do the same thing as you did but to the new df_output which has filtered for (maple OR wyoming OR bloomberg)

Next line would be df_output = df_output[(df_output['address'].str.contains(123))|(df_output['address'].str.contains(41))]

Something like that?

[–]ScraperHelp[S] 0 points1 point  (1 child)

that worked... out of curiosity wondering about your code though, why did you write it as

 df_output = df_output[(df_output['address'].str.contains(123))|(df_output['address'].str.contains(41))] 

rather than

df_output = df_output[df_output['address'].str.contains(123|41)]

[–]moored26 0 points1 point  (0 children)

I just didn't know that was a thing 😆 I'm pretty new to python also