简体   繁体   English

为什么多索引外部索引名称右对齐,而不是左对齐

[英]Why is multi Index outer Index Name right justified, as opposed to left

The below multi index data frame displays in jupyter lab with the outer indices 'O' and 'I' right justified. 下面的多索引数据框在jupyter实验室中显示,外部索引“ O”和“ I”右对齐。 Whereas, in the cookbook https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook-multi-index 而在食谱中https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook-multi-index

..the outer indices appear left justified which makes more sense to me. ..外部索引似乎左对齐,这对我来说更有意义。 Is there a setting I need to change to change the justification? 是否需要更改设置以更改理由? Do other people run the code and see a different justification than the cookbook? 是否其他人运行该代码并看到与菜谱不同的理由?

cols = pd.MultiIndex.from_tuples([(x, y) for x in ['A', 'B', 'C'] for y in ['O', 'I']])

df = pd.DataFrame(np.random.randn(2, 6), index=['n', 'm'], columns=cols)

I see the same as in the cookbook. 我看到的与食谱相同。 Not sure where the issue is 不确定问题出在哪里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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