I would like to drop every column that ends in a 'y' in my data frame. For some reason, the data I have has each column listed twice, with the only thing different being the column name, like so:
d = {'Team': ['1', '2', '3'], 'Team_y': ['1', '2', '3'], 'Color' : ['red', 'green', 'blue'], 'Color_y' : ['red', 'green', 'blue']}
df = pd.DataFrame(data=d)
df
Team Team_y Color Color_y
0 1 1 red red
1 2 2 green green
2 3 3 blue blue
I know it's some sort of string formatting. I tried indexing the last letter using [-1] but couldn't quite get it to work. Thanks!