I was transforming my object data to float and int and I found this error:
ValueError: invalid literal for int() with base 10: '[24]'
from what I understand the [] are like strings and I’m having trouble removing them and leaving just the number, how do I do that? I tried to replace but when I put ‘[]’ as a character to replace, it understands as a list, I want to remove [] to leave only the number,
>Solution :
You can try .str.strip
df['out'] = df['col'].str.strip('[]')
print(df)
col out
0 [23] 23
1 [23] 23
2 [23] 23