Skip to content
Advertisement

isin only returning first line from csv

I’m reading from a sqlite3 db into a df:

JavaScript

Then I have a symbols.csv file which I want to use to filter the above df:

JavaScript

Here’s how I’ve tried to do it:

JavaScript

But for some reason I only get the first line returned from the csv:

JavaScript

Where am I going wrong here?

Advertisement

Answer

You need convert csv file to Series, here is added column name and for Series select it (e.g. by position):

JavaScript

And then remove possible traling spaces in both by Series.str.strip:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement