Dataframe isin function Buffer was wrong number of dimensions error

36 views Asked by At

I have a dataframe with customer info including first and last name (separate columns). I have an array of names and I want to separate the dataframe according to the names array. I load the csv file as so:

names = np.loadtxt("names.csv", delimiter=",", dtype=str)

I tried to use the isn.any function but got the buffer was wrong number of dimensions (expected 1, got 2) error

df = df[df[['First Name','Last Name']].isin(names).any(axis=1)]

How do I resolve this?

0

There are 0 answers