Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 熊猫数据帧:大量dict值,打印方式?_Python_Dictionary_Pandas - Fatal编程技术网

Python 熊猫数据帧:大量dict值,打印方式?

Python 熊猫数据帧:大量dict值,打印方式?,python,dictionary,pandas,Python,Dictionary,Pandas,我正在尝试将一个包含大量数据的默认dict转换为一个数据帧。当字典中的值的#很小(比如说,10)时,我得到如下结果: Obama Romney dates 0 47.5 41.5 2/01/2011 1 47.5 41.5 2/02/2011 2 47.5 41.5 2/03/2011 3 47.5 41.5 2/04/2011 4 47.5 41.5 2/05/2011 5

我正在尝试将一个包含大量数据的默认dict转换为一个数据帧。当字典中的值的#很小(比如说,10)时,我得到如下结果:

       Obama Romney      dates
    0   47.5   41.5  2/01/2011
    1   47.5   41.5  2/02/2011
    2   47.5   41.5  2/03/2011
    3   47.5   41.5  2/04/2011
    4   47.5   41.5  2/05/2011
    5   47.5   41.5  2/06/2011
    6   46.4   42.0  2/07/2011
    7   46.4   42.0  2/08/2011
    8   46.7   42.7  2/09/2011
    9   46.7   42.7  2/10/2011
    10  47.3   42.0  2/11/2011
当我试图打印数据帧时——这就是我想要的。但当项目为100或更多时,我只得到一个摘要:

    <class 'pandas.core.frame.DataFrame'>
    Int64Index: 652 entries, 0 to 651
    Data columns (total 3 columns):
    Obama     652  non-null values
    Romney    652  non-null values
    dates     652  non-null values
    dtypes: object(3)

INT64索引:652个条目,0到651
数据列(共3列):
Obama 652非空值
罗姆尼652非空值
日期652非空值
数据类型:对象(3)

有没有办法像以前那样打印10个项目的值?

查看
set\u选项
功能:

import pandas as pd

pd.set_option('max_rows', 150)

查看
set_选项
功能:

import pandas as pd

pd.set_option('max_rows', 150)
如果需要,它将查看前n行(默认情况下,n=5):

或其相反,对于最后n行

请注意,大家一致认为这是令人困惑的:。以下是master/dev中的当前行为:

In [21]: pd.concat([df] * 100)  # 100 copies of df
Out[21]: 
    Obama  Romney      dates
0    47.5    41.5  2/01/2011
1    47.5    41.5  2/02/2011
2    47.5    41.5  2/03/2011
# ommiting a load of lines here
# which make it up to 100 (pd.options.display.max_rows)
3    47.5    41.5  2/04/2011
4    47.5    41.5  2/05/2011
      ...     ...        ...

[1100 rows x 3 columns]
如果需要,它将查看前n行(默认情况下,n=5):

或其相反,对于最后n行

请注意,大家一致认为这是令人困惑的:。以下是master/dev中的当前行为:

In [21]: pd.concat([df] * 100)  # 100 copies of df
Out[21]: 
    Obama  Romney      dates
0    47.5    41.5  2/01/2011
1    47.5    41.5  2/02/2011
2    47.5    41.5  2/03/2011
# ommiting a load of lines here
# which make it up to 100 (pd.options.display.max_rows)
3    47.5    41.5  2/04/2011
4    47.5    41.5  2/05/2011
      ...     ...        ...

[1100 rows x 3 columns]

你就不能在各行之间循环吗?你就不能在各行之间循环吗?仅供参考,报告将在0.13中更改!仅供参考,报告将在0.13中更改!