I am trying to replace []
values with ''
, strip the spaces, and return a clean Dataframe
Distance TGR Grade TGR1
0 [342m, 342m, 530m, 342m] [M, M, RW, RW] [1, 1, 7, 1]
1 [390m, 390m, 390m, 390m,450] [M, 7, 6G, X45, X67] [1, 2, 4, 5, 5]
I have applied several functions but the Dataframe is either returns nan value or it returns the same Dataframe
To from both sides of the values
df[df.columns]=df[df.columns].apply(lambda x:x.str.strip())
df[cols]=df[cols].astype(str).agg(lambda x:x.str.strip("frozenset({''})"),1)
df.replace('\[', '', regex=True)
df.replace('\]', '', regex=True)
but the df still remains the same