df['collection'] = df['collection'].astype('string').str.strip()
df['collection'] = [int(str(i).replace('万','0000')) for i in df['collection']]
df['text'] = [str(i)[3:] for i in df['text']]
df['comments'] = [0 if '评论' in str(i).strip() else int(i) for i in df['comments']]
ValueError Traceback (most recent call last)
Input In [44], in <cell line: 2>()
1 df['collection'] = df['collection'].astype('string').str.strip()
----> 2 df['collection'] = [int(str(i).replace('万','0000')) for i in df['collection']]
3 df['text'] = [str(i)[3:] for i in df['text']]
4 df['comments'] = [0 if '评论' in str(i).strip() else int(i) for i in df['comments']]
Input In [44], in (.0)
1 df['collection'] = df['collection'].astype('string').str.strip()
----> 2 df['collection'] = [int(str(i).replace('万','0000')) for i in df['collection']]
3 df['text'] = [str(i)[3:] for i in df['text']]
4 df['comments'] = [0 if '评论' in str(i).strip() else int(i) for i in df['comments']]
ValueError: invalid literal for int() with base 10: '收藏'