2
Pandas DataFrame在显示字符串时省略了引号。熊猫DataFrame字符串报价显示选项
In [43]: df = pd.DataFrame(np.array([['foo', 'bar', 'bim', 'uncomfortably'],
....: ['horse', 'cow', 'banana', 'apple']]))
....:
In [45]: df
Out[45]:
0 1 2 3
0 foo bar bim uncomfortably
1 horse cow banana apple
如何让它在下面的引号内显示字符串?
In [45]: df
Out[45]:
0 1 2 3
0 'foo' 'bar' 'bim' 'uncomfortably'
1 'horse' 'cow' 'banana' 'apple'
我知道如果我这样做
df[0][0]
它返回
'foo' (with quotation marks)
但是我希望看到,甚至当我打电话数据帧作为一个整体引号。
(或'df.applymap(repr)'。) – DSM
@DSM感谢您的提示。更新了我的答案。 –
谢谢@MikeMüller – Aaron