[英]Converting from Unicode in Python
How do strip I convert Unicode to strings? 如何将Unicode转换为字符串?
df = pd.DataFrame ({'A':[u'Joe', u'Bill']})
test = df['A'] == 'Joe'
This works on converting columns full to Unicode to floats: 这适用于将完整的Unicode列转换为浮点数:
df['B'] = df['B'].astype(float)
But when I try: 但是当我尝试:
df['A'] = df['A'].astype(str)
The output is: 输出为:
0 J
1 B
Unicode是字符串,在那里不需要转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.