I have data frames which contain e.g.:
"vendor a::ProductA"
"vendor b::ProductA"
"vendor a::Productb"
I need to
If it is in a specific column (having name: column) of a data frame (having name: dataframe), you can also use
dataframe.column.str.replace("(::).*","")
It gives you the below result
column new_column
0 vendor a::ProductA vendor a
1 vendor b::ProductA vendor b
2 vendor a::Productb vendor a
By using this you need not specify any position, as it gets rid of anything present after '::'
I guess this might come oh help,Good luck!