I have a dataframe with multiple columns of same name, which causes .loc
to fail when accessing by column name.
df = pd.DataFrame([['abc', 'xyz'], ['abc', 'xyz'], ['xyz', 'abc']], columns=['max_speed', 'max_speed'])
I am trying the following method mentioned in this answer but its not successful.
df.loc[df.columns[0] == 'abc']
df.loc[df.columns[1].str.contains('xyz')]