最大尺寸、列数和行数有限制吗?

51 投票
3 回答
107752 浏览
提问于 2025-04-17 19:21

.. 如果是这样的话,pandas的最大限制是什么呢?

抱歉,这个问题看起来很基础,但我在pandas.pydata.org上找不到答案。

3 个回答

-1

你可以很简单地使用 .set_option() 这个函数来做到这一点。

pd.set_option('display.max_rows', 500) 
# Where 500 is the maximum number of rows that you want to show
34

不,Pandas 在背后使用的是 numpy 数组,所以我认为你能放进内存里的数据量就是限制。关于 numpy 数组的更多讨论,你可以在 这里 找到。

40

限制就是你的内存。(不过这些限制其实很大)

另一方面,关于在“Jupyter Notebook”中显示大量行或列的可能性,有一些预设的限制。

例如,你可以:

print (pd.options.display.max_columns) # <--- this will display your limit
pd.options.display.max_columns = 500 # this will set limit of columns to 500

同样的想法也适用于行:

display.max_rows

更多详细信息请查看: https://pandas.pydata.org/pandas-docs/stable/options.html

撰写回答