Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- source_path = "replace-example.csv" # change to your path
- df = pd.read_csv(source_path, sep='\t')
- subset = df[["Gene", "Annotation", "No. isolates"]]
- df = df.where(~df.notna(), 1) # fills all not null with 1
- df = df.fillna(0) # fills all null with 0
- df[["Gene", "Annotation", "No. isolates"]] = subset
- df
Advertisement
Add Comment
Please, Sign In to add comment