数据框“ A”列中的数据
'45-54 on Treatment for less than 1 month (Patient) '
'Ocetech| 65-74 Male on Treatment for 10 years or more (Patient) '
'What is this? Don't know screen name | 65-74 Female on Treatment for 6 months to less than 1 year (Patient) '
将列“ A”转换为字符串
c2 = c1.to_string(columns = ['A'])
将其转换并存储到c2后,行中的文本不完整,一半的文本没有显示。
当前输出:
'45-54 on Treatment for less than 1 ...
'Ocetech| 65-74 Male on Treatment f...
'What is this? Don't know scree...
我尝试通过使用
增加字符串长度c2 = c1['A'].astype('|S80')
但是显示错误,
SystemError: <class 'UnicodeEncodeError'> returned a result with an error set
答案 0 :(得分:0)
我建议使用此:
pd.options.display.max_colwidth = 1000
但是,如果这行不通,请尝试在加载它们时确保所有字符串均为utf-8。