在notebook上显示Pandas Dataframe对象时,多个空格显示为单个空格。而且我不能复制多个空格。
我想按原样显示所有空格,并复制它们的字符串。
有没有办法做到这一点?
display(pd.DataFrame([["ab c", "ab c"], ["ab c", "ab c"]]))实际
0 1
0 ab c ab c
1 ab c ab c我的期望
0 1
0 ab c ab c
1 ab c ab c发布于 2020-07-28 16:38:10
这个问题已经在不同的上下文中得到了回答:
keep the extra whitespaces in display of pandas dataframe in jupyter notebook
def print_df(df):
return df.style.set_properties(**{'white-space': 'pre'})
print_df(df)https://stackoverflow.com/questions/62283545
复制相似问题