Here is a column of my dataframe.
I want to select for example for the first image 28g and delete (1 ONZ). how can I do ?
You can extract everything outside of the parentheses:
# original df
>>> df
serving_size
0 NaN
1 28 g (1 ONZ)
2 28 g (0.25 cup)
>>> df.serving_size.str.extract('(.*)\(.*\)')
0 NaN
1 28 g
2 28 g
Name: serving_size, dtype: object
28, not28g. Please update the question accordingly. it is misleading.