I have a column in my CSV file in which I would like to search for list of strings and add a new column of 0/1, if any value from the list is present then 1 else 0.
I have two lists :
- 'UC''iCD', 'Chrons disease', 'Chrons', 'IBD', 'Ulcerative colitis', 'PMC', 'P80', 'Chron disease'
- Donor, healthy, non-IBD, Control.
My column also has NA values
By far I have this in which I was just trying to match list of stings:
import csv
import pandas as pd
with open('biosample.csv') as csvfile:
df = pd.read_csv('biosample.csv', delimiter = ',', dtype= 'unicode',
error_bad_lines=False)
df1 = df.set_index(['Sample_Info'])
print(df1.loc['UC''iCD', 'Chrons disease', 'Chrons', 'IBD', 'Ulcerative
colitis', 'PMC', 'P80', 'Chron disease])
To this I am getting multiple errors like in _has_valid_type_error,in has_valid_type_error.
I have gone through already posted questions but in none this kind of errors are mentioned.