I am trying to edit my pandas dataframe based on some specifications. I need a certain layout of my cells in order for my program to work. Currently, my data looks something like this:
x y
A 1 information
B 2 information and some stuff
C 3 information and random stuff
But I need it to look like this:
x y
A 1 information
B 2 information
C 3 information
So basically, it needs to scan through every cell and if check for a keyword ("and" in my example). Then it needs to delete everything after the keyword, including the keyword, leaving only the important information behind.
I currently just can't wrap my head around an efficient way to do this. Any help is appreciated