简体   繁体   中英

Converting from Unicode in Python

How do strip I convert Unicode to strings?

df = pd.DataFrame ({'A':[u'Joe', u'Bill']})
test = df['A'] == 'Joe'

This works on converting columns full to Unicode to floats:

df['B'] = df['B'].astype(float)

But when I try:

df['A'] = df['A'].astype(str)

The output is:

0    J
1    B

Unicode是字符串,在那里不需要转换。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM