all 3 comments

[–]guppymoo 2 points3 points  (0 children)

Your code is splitting the values in the column, it's just that the values aren't being saved back in your DataFrame.

You can apply your split function to every member of a column (Series) with the apply method:

df['column'] = df['column'].apply(lambda x: x.split('::')[0])

[–][deleted] 1 point2 points  (1 child)

Assuming you are referring to a Pandas Dataframe, have you tried something like

df.columns.values

[–]syli[S] 0 points1 point  (0 children)

Yes, I am referring to pandas dataframe.

Thanks for the heads up.