I found this Pandas Dataframe - select columns with a specific value in a specific row But I couldn't figure out how to do this in iteration from user input.
no_to_search = input()
with open('jen.csv', 'rt') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
if no_to_search==row
df=pd.read_csv('jen.csv')
for col in df.columns:
if (df[col] == 1).any():
print(col)
[refer image via this link 1]
I want to retrieve column names with value 1 for the input row matching.