版本0.14.0(2014年5月31日)#

这是从0.13.1开始的一个主要版本,包括少量的API更改、几个新功能、增强功能和性能改进,以及大量的错误修复。我们建议所有用户升级到此版本。

警告

在0.14.0中全部 NDFrame 基于容器的容器经历了重大的内部重构。在此之前,每个同质数据块都有自己的标签,必须格外小心才能使这些标签与父容器的标签保持同步。这不应具有任何可见的用户/API行为更改 (GH6745 )

API更改#

  • read_excel 使用0作为默认图纸 (GH6573 )

  • iloc will now accept out-of-bounds indexers for slices, e.g. a value that exceeds the length of the object being indexed. These will be excluded. This will make pandas conform more with python/numpy indexing of out-of-bounds values. A single indexer that is out-of-bounds and drops the dimensions of the object will still raise IndexError (GH6296, GH6299). This could result in an empty axis (e.g. an empty DataFrame being returned)

    In [1]: dfl = pd.DataFrame(np.random.randn(5, 2), columns=list('AB'))
    
    In [2]: dfl
    Out[2]: 
              A         B
    0  0.469112 -0.282863
    1 -1.509059 -1.135632
    2  1.212112 -0.173215
    3  0.119209 -1.044236
    4 -0.861849 -2.104569
    
    [5 rows x 2 columns]
    
    In [3]: dfl.iloc[:, 2:3]
    Out[3]: 
    Empty DataFrame
    Columns: []
    Index: [0, 1, 2, 3, 4]
    
    [5 rows x 0 columns]
    
    In [4]: dfl.iloc[:, 1:3]
    Out[4]: 
              B
    0 -0.282863
    1 -1.135632
    2 -0.173215
    3 -1.044236
    4 -2.104569
    
    [5 rows x 1 columns]
    
    In [5]: dfl.iloc[4:6]
    Out[5]: 
              A         B
    4 -0.861849 -2.104569
    
    [1 rows x 2 columns]
    

    这些是超出范围的选择

    >>> dfl.iloc[[4, 5, 6]]
    IndexError: positional indexers are out-of-bounds
    
    >>> dfl.iloc[:, 4]
    IndexError: single positional indexer is out-of-bounds
    
  • 具有负开始、停止和步长值的切片更好地处理拐角情况 (GH6531 ):

    • df.iloc[:-len(df)] 现在是空的

    • df.iloc[len(df)::-1] 现在反向枚举所有元素

  • 这个 DataFrame.interpolate() 关键字 downcast 默认设置已从 inferNone 。这是为了保留原始数据类型,除非另有明确要求 (GH6290 )。

  • 在将数据帧转换为HTML时,它通常会返回 Empty DataFrame 。此特例已被删除,而是返回一个包含列名的标题 (GH6062 )。

  • SeriesIndex 现在内部共享更多常见的操作,例如 factorize(),nunique(),value_counts() 现在支持 Index 类型也是如此。这个 Series.weekday 为了保持API一致性,从系列中删除了中的属性。使用 DatetimeIndex/PeriodIndex 方法现在将引发 TypeError 。 (GH4551GH4056GH5519GH6380GH7206 )。

  • Add is_month_start, is_month_end, is_quarter_start, is_quarter_end, is_year_start, is_year_end accessors for DateTimeIndex / Timestamp which return a boolean array of whether the timestamp(s) are at the start/end of the month/quarter/year defined by the frequency of the DateTimeIndex / Timestamp (GH4565, GH6998)

  • 局部变量的用法在中已更改 pandas.eval()/DataFrame.eval() /:meth:DataFrame.query (GH5987 )。对于 DataFrame 方法,有两个方面发生了变化

    • 现在,列名优先于本地变量

    • 必须显式引用局部变量。这意味着,即使您有一个局部变量, not 列,您仍必须使用 '@' 前缀。

    • 你可以有这样的表达方式 df.query('@a < a') 没有任何投诉来自 pandas 关于名称的歧义 a

    • 最高层 pandas.eval() 函数不允许您使用 '@' 前缀,并向您提供一条错误消息,告诉您这样做。

    • NameResolutionError 已被移除,因为它不再是必需的。

  • 定义并记录查询/评估中列名称与索引名称的顺序 (GH6676 )

  • concat will now concatenate mixed Series and DataFrames using the Series name or numbering columns as needed (GH2385). See the docs

  • 切片和高级/布尔索引操作 Index 类以及 Index.delete()Index.drop() 方法将不再更改结果索引的类型 (GH6440GH7040 )

    In [6]: i = pd.Index([1, 2, 3, 'a', 'b', 'c'])
    
    In [7]: i[[0, 1, 2]]
    Out[7]: Index([1, 2, 3], dtype='object')
    
    In [8]: i.drop(['a', 'b', 'c'])
    Out[8]: Index([1, 2, 3], dtype='object')
    

    以前,上述操作将返回 Int64Index 。如果您希望手动执行此操作,请使用 Index.astype()

    In [9]: i[[0, 1, 2]].astype(np.int_)
    Out[9]: Int64Index([1, 2, 3], dtype='int64')
    
  • set_index 不再将多重索引转换为元组索引。例如,在本例中,旧行为返回一个索引 (GH6459 ):

    # Old behavior, casted MultiIndex to an Index
    In [10]: tuple_ind
    Out[10]: Index([('a', 'c'), ('a', 'd'), ('b', 'c'), ('b', 'd')], dtype='object')
    
    In [11]: df_multi.set_index(tuple_ind)
    Out[11]: 
                   0         1
    (a, c)  0.471435 -1.190976
    (a, d)  1.432707 -0.312652
    (b, c) -0.720589  0.887163
    (b, d)  0.859588 -0.636524
    
    [4 rows x 2 columns]
    
    # New behavior
    In [12]: mi
    Out[12]: 
    MultiIndex([('a', 'c'),
                ('a', 'd'),
                ('b', 'c'),
                ('b', 'd')],
               )
    
    In [13]: df_multi.set_index(mi)
    Out[13]: 
                0         1
    a c  0.471435 -1.190976
      d  1.432707 -0.312652
    b c -0.720589  0.887163
      d  0.859588 -0.636524
    
    [4 rows x 2 columns]
    

    将多个索引传递给 set_index

    # Old output, 2-level MultiIndex of tuples
    In [14]: df_multi.set_index([df_multi.index, df_multi.index])
    Out[14]: 
                          0         1
    (a, c) (a, c)  0.471435 -1.190976
    (a, d) (a, d)  1.432707 -0.312652
    (b, c) (b, c) -0.720589  0.887163
    (b, d) (b, d)  0.859588 -0.636524
    
    [4 rows x 2 columns]
    
    # New output, 4-level MultiIndex
    In [15]: df_multi.set_index([df_multi.index, df_multi.index])
    Out[15]: 
                    0         1
    a c a c  0.471435 -1.190976
      d a d  1.432707 -0.312652
    b c b c -0.720589  0.887163
      d b d  0.859588 -0.636524
    
    [4 rows x 2 columns]
    
  • pairwise 在统计矩函数中增加了关键字 rolling_covrolling_correwmcovewmcorrexpanding_covexpanding_corr 允许计算移动窗口协方差和相关矩阵 (GH4950 )。看见 Computing rolling pairwise covariances and correlations 在文件里。

    In [1]: df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD'))
    
    In [4]: covs = pd.rolling_cov(df[['A', 'B', 'C']],
      ....:                       df[['B', 'C', 'D']],
      ....:                       5,
      ....:                       pairwise=True)
    
    
    In [5]: covs[df.index[-1]]
    Out[5]:
              B         C         D
    A  0.035310  0.326593 -0.505430
    B  0.137748 -0.006888 -0.005383
    C -0.006888  0.861040  0.020762
    
  • Series.iteritems() 现在是惰性的(返回迭代器而不是列表)。这是0.14之前记录的行为。 (GH6760 )

  • 已添加 nuniquevalue_counts 执行以下功能 Index 用于计算唯一元素。 (GH6734 )

  • stackunstack 现在,提高一个 ValueErrorlevel 关键字引用 Index (之前提出了一个 KeyError )。 (GH6738 )

  • drop unused order argument from Series.sort; args now are in the same order as Series.order; add na_position arg to conform to Series.order (GH6847)

  • 的默认排序算法 Series.order 现在是 quicksort ,符合,符合 Series.sort (和NumPy默认设置)

  • 添加 inplace 关键字至 Series.order/sort 使它们颠倒过来 (GH6859 )

  • DataFrame.sort 现在将NaN放在排序的开头或结尾,根据 na_position 参数。 (GH3917 )

  • 接受 TextFileReader 在……里面 concat ,这影响了一个常见的用户习惯用法 (GH6583 ),这是从0.13.1开始的回归。

  • 已添加 factorize 执行以下功能 IndexSeries 获取索引器和唯一值 (GH7090 )

  • describe 在混合了时间戳和类似字符串的对象的DataFrame上,返回不同的索引 (GH7088 )。以前,索引是无意中排序的。

  • 算术运算 only bool DTYPE现在会给出一个警告,表明它们是在Python空间中针对 +- ,以及 * 为所有其他人提供运营和加薪 (GH7011GH6762GH7015GH7210 )

    >>> x = pd.Series(np.random.rand(10) > 0.5)
    >>> y = True
    >>> x + y  # warning generated: should do x | y instead
    UserWarning: evaluating in Python space because the '+' operator is not
    supported by numexpr for the bool dtype, use '|' instead
    >>> x / y  # this raises because it doesn't make sense
    NotImplementedError: operator '/' not implemented for bool dtypes
    
  • 在……里面 HDFStoreselect_as_multiple 将始终引发 KeyError ,当找不到键或选择器时 (GH6177 )

  • df['col'] = valuedf.loc[:,'col'] = value 现在完全等同;以前 .loc 不一定会强制生成序列的数据类型 (GH6149 )

  • dtypesftypes 现在返回一个带有 dtype=object 在空容器上 (GH5740 )

  • df.to_csv 如果既没有提供目标路径,也没有提供缓冲区,现在将返回CSV数据的字符串 (GH6061 )

  • pd.infer_freq() 现在将引发一个 TypeError 如果被赋予无效的 Series/Index 类型 (GH6407GH6463 )

  • 传递给的元组 DataFame.sort_index 将被解释为索引的级别,而不需要元组列表 (GH4370 )

  • 所有偏移操作现在都返回 Timestamp 类型(而不是日期时间)、业务/周频率不正确 (GH4069 )

  • to_excel 现在转换为 np.inf 转换为字符串表示形式,可由 inf_rep 关键字参数(Excel没有本机Inf表示形式) (GH6782 )

  • Replace pandas.compat.scipy.scoreatpercentile with numpy.percentile (GH6810)

  • .quantile 在一个 datetime[ns] 系列现在返回 Timestamp 而不是 np.datetime64 对象 (GH6810 )

  • change AssertionError to TypeError for invalid types passed to concat (GH6583)

  • 提高一名 TypeError 什么时候 DataFrame 传递一个迭代器作为 data 论据 (GH5357 )

显示更改#

  • The default way of printing large DataFrames has changed. DataFrames exceeding max_rows and/or max_columns are now displayed in a centrally truncated view, consistent with the printing of a pandas.Series (GH5603).

    在以前的版本中,一旦达到尺寸约束和省略号(...),DataFrame就会被截断表示部分数据已被切断。

    以前的样子是截断。

    在当前版本中,大的DataFrame被集中截断,显示两个维度的头和尾的预览。

    新面貌。
  • 允许选项 'truncate'display.show_dimensions 如果框架被截断,则仅显示尺寸 (GH6547 )。

    的默认设置 display.show_dimensions 现在将是 truncate 。这与系列的显示长度一致。

    In [16]: dfd = pd.DataFrame(np.arange(25).reshape(-1, 5),
       ....:                    index=[0, 1, 2, 3, 4],
       ....:                    columns=[0, 1, 2, 3, 4])
       ....: 
    
    # show dimensions since this is truncated
    In [17]: with pd.option_context('display.max_rows', 2, 'display.max_columns', 2,
       ....:                        'display.show_dimensions', 'truncate'):
       ....:     print(dfd)
       ....: 
         0  ...   4
    0    0  ...   4
    ..  ..  ...  ..
    4   20  ...  24
    
    [5 rows x 5 columns]
    
    # will not show dimensions since it is not truncated
    In [18]: with pd.option_context('display.max_rows', 10, 'display.max_columns', 40,
       ....:                        'display.show_dimensions', 'truncate'):
       ....:     print(dfd)
       ....: 
        0   1   2   3   4
    0   0   1   2   3   4
    1   5   6   7   8   9
    2  10  11  12  13  14
    3  15  16  17  18  19
    4  20  21  22  23  24
    
  • 多指标级数显示中的回归 display.max_rows 小于该系列的长度 (GH7101 )

  • 修复了截断的Series或DataFrame不显示带有 large_repr 设置为‘INFO’ (GH7105 )

  • 这个 verbose 输入关键字 DataFrame.info() ,它控制是否缩短 info 代表,现在是 None 默认情况下。这将遵循中的全局设置 display.max_info_columns 。可以使用覆盖全局设置 verbose=Trueverbose=False

  • 修复了使用 info Repr不遵守 display.max_info_columns 设置 (GH6939 )

  • 偏移/频率信息现在以时间戳表示 __repr__ (GH4553 )

文本解析API更改#

read_csv()/read_table() 现在将是更嘈杂的w.r.t无效选项,而不是退回到 PythonParser

  • Raise ValueError when sep specified with delim_whitespace=True in read_csv()/read_table() (GH6607)

  • Raise ValueError when engine='c' specified with unsupported options in read_csv()/read_table() (GH6607)

  • 加薪 ValueError 当回退到python解析器导致选项被忽略时 (GH6607 )

  • 生产 ParserWarning 在未忽略任何选项时回退到python解析器 (GH6607 )

  • 翻译 sep='\s+'delim_whitespace=True 在……里面 read_csv()/read_table() 如果未指定其他不支持C语言的选项 (GH6607 )

GroupBy API更改#

某些Groupby方法的行为更加一致:

  • GroupBy headtail 现在表现得更像 filter 而不是一个集合:

    In [19]: df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], columns=['A', 'B'])
    
    In [20]: g = df.groupby('A')
    
    In [21]: g.head(1)  # filters DataFrame
    Out[21]: 
       A  B
    0  1  2
    2  5  6
    
    [2 rows x 2 columns]
    
    In [22]: g.apply(lambda x: x.head(1))  # used to simply fall-through
    Out[22]: 
         A  B
    A        
    1 0  1  2
    5 2  5  6
    
    [2 rows x 2 columns]
    
  • Groupby Head and Tail尊重列选择:

    In [23]: g[['B']].head(1)
    Out[23]: 
       B
    0  2
    2  6
    
    [2 rows x 1 columns]
    
  • GroupBy nth 现在默认情况下减少;筛选可以通过传递 as_index=False 。具有可选的 dropna 参数以忽略NaN。看见 the docs

    减少

    In [24]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6]], columns=['A', 'B'])
    
    In [25]: g = df.groupby('A')
    
    In [26]: g.nth(0)
    Out[26]: 
         B
    A     
    1  NaN
    5  6.0
    
    [2 rows x 1 columns]
    
    # this is equivalent to g.first()
    In [27]: g.nth(0, dropna='any')
    Out[27]: 
         B
    A     
    1  4.0
    5  6.0
    
    [2 rows x 1 columns]
    
    # this is equivalent to g.last()
    In [28]: g.nth(-1, dropna='any')
    Out[28]: 
         B
    A     
    1  4.0
    5  6.0
    
    [2 rows x 1 columns]
    

    过滤

    In [29]: gf = df.groupby('A', as_index=False)
    
    In [30]: gf.nth(0)
    Out[30]: 
       A    B
    0  1  NaN
    2  5  6.0
    
    [2 rows x 2 columns]
    
    In [31]: gf.nth(0, dropna='any')
    Out[31]: 
       A    B
    A        
    1  1  4.0
    5  5  6.0
    
    [2 rows x 2 columns]
    
  • GROUPBY现在不会为非Cython函数返回已分组的列 (GH5610GH5614GH6732 ),因为它已经是索引

    In [32]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6], [5, 8]], columns=['A', 'B'])
    
    In [33]: g = df.groupby('A')
    
    In [34]: g.count()
    Out[34]: 
       B
    A   
    1  1
    5  2
    
    [2 rows x 1 columns]
    
    In [35]: g.describe()
    Out[35]: 
          B                                        
      count mean       std  min  25%  50%  75%  max
    A                                              
    1   1.0  4.0       NaN  4.0  4.0  4.0  4.0  4.0
    5   2.0  7.0  1.414214  6.0  6.5  7.0  7.5  8.0
    
    [2 rows x 8 columns]
    
  • 传球 as_index 将保持已分组的列不变(这在0.14.0中没有更改)

    In [36]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6], [5, 8]], columns=['A', 'B'])
    
    In [37]: g = df.groupby('A', as_index=False)
    
    In [38]: g.count()
    Out[38]: 
       A  B
    0  1  1
    1  5  2
    
    [2 rows x 2 columns]
    
    In [39]: g.describe()
    Out[39]: 
          A                                        B                                        
      count mean  std  min  25%  50%  75%  max count mean       std  min  25%  50%  75%  max
    0   2.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   1.0  4.0       NaN  4.0  4.0  4.0  4.0  4.0
    1   2.0  5.0  0.0  5.0  5.0  5.0  5.0  5.0   2.0  7.0  1.414214  6.0  6.5  7.0  7.5  8.0
    
    [2 rows x 16 columns]
    
  • 允许通过更复杂的GROUP BY指定 pd.Grouper ,例如同时按时间和字符串字段分组。看见 the docs 。 (GH3794 )

  • 执行GROUP BY操作时更好地传播/保存系列名称:

    • SeriesGroupBy.agg 将确保将原始序列的名称属性传播到结果 (GH6265 )。

    • If the function provided to GroupBy.apply returns a named series, the name of the series will be kept as the name of the column index of the DataFrame returned by GroupBy.apply (GH6124). This facilitates DataFrame.stack operations where the name of the column index is used as the name of the inserted column containing the pivoted data.

SQL#

SQL读写函数现在通过SQLAlChemy支持更多的数据库风格 (GH2717GH4163GH5950GH6292 )。可以使用SQLAlChemy支持的所有数据库,如PostgreSQL、MySQL、Oracle、Microsoft SQL SERVER(请参阅 included dialects )。

提供DBAPI连接对象的功能将仅在将来的sqlite3中受支持。这个 'mysql' 风味已弃用。

新功能 read_sql_query()read_sql_table() 并介绍了它们的特点。功能 read_sql() 作为对其他两个的方便包装器,并将根据提供的输入(数据库、表名或SQL查询)委托特定的功能。

在实践中,您必须提供一个SQLAlChemy engine 添加到SQL函数。要连接到SQLAlChemy,您可以使用 create_engine() 函数从数据库URI创建引擎对象。您只需要为每个要连接的数据库创建一次引擎。对于内存中的SQLite数据库:

In [40]: from sqlalchemy import create_engine
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [40], in <cell line: 1>()
----> 1 from sqlalchemy import create_engine

ModuleNotFoundError: No module named 'sqlalchemy'

# Create your connection.
In [41]: engine = create_engine('sqlite:///:memory:')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [41], in <cell line: 1>()
----> 1 engine = create_engine('sqlite:///:memory:')

NameError: name 'create_engine' is not defined

engine 然后可以用来向该数据库写入数据或从该数据库读取数据:

In [42]: df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'c']})

In [43]: df.to_sql('db_table', engine, index=False)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [43], in <cell line: 1>()
----> 1 df.to_sql('db_table', engine, index=False)

NameError: name 'engine' is not defined

您可以通过指定表名从数据库中读取数据:

In [44]: pd.read_sql_table('db_table', engine)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [44], in <cell line: 1>()
----> 1 pd.read_sql_table('db_table', engine)

NameError: name 'engine' is not defined

或通过指定一个SQL查询:

In [45]: pd.read_sql_query('SELECT * FROM db_table', engine)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [45], in <cell line: 1>()
----> 1 pd.read_sql_query('SELECT * FROM db_table', engine)

NameError: name 'engine' is not defined

对SQL函数的其他增强包括:

  • 支持写入索引。这可以使用 index 关键字(默认为True)。

  • 指定写入索引时要使用的列标签 index_label

  • 属性指定要解析为日期时间的字符串列 parse_dates 输入关键字 read_sql_query()read_sql_table()

警告

某些现有函数或函数别名已弃用,将在未来版本中删除。这包括: tqueryuqueryread_frameframe_querywrite_frame

警告

使用DBAPI连接对象时对‘MySQL’风格的支持已弃用。MySQL将通过SQLAlChemy引擎得到进一步支持 (GH6900 )。

使用切片器的多索引#

在0.14.0中,我们添加了一种对多索引对象进行切片的新方法。您可以通过提供多个索引器来对多索引进行切片。

您可以提供任何选择器,就像按标签编制索引一样,请参见 Selection by Label ,包括切片、标签列表、标签和布尔索引器。

您可以使用 slice(None) 选择所有内容的步骤 that 水平。您不需要指定所有 更深一层 级别,它们将被隐含为 slice(None)

像往常一样, 两边都有 的切片机被包括在内,因为这是标签索引。

看见 the docs 另见问题 (GH6134GH4036GH3057GH2598GH5641GH7106 )

警告

属性中的所有轴。 .loc 说明符,表示 索引 而对于 。它们是一些不明确的情况,其中传递的索引器可能被错误地解释为索引 both 轴,而不是行的MuliIndex。

您应该这样做:

  >>> df.loc[(slice('A1', 'A3'), ...), :]  # noqa: E901

rather than this:
>>> df.loc[(slice('A1', 'A3'), ...)]  # noqa: E901

警告

您需要确保选择轴是完全词法排序的!

In [46]: def mklbl(prefix, n):
   ....:     return ["%s%s" % (prefix, i) for i in range(n)]
   ....: 

In [47]: index = pd.MultiIndex.from_product([mklbl('A', 4),
   ....:                                     mklbl('B', 2),
   ....:                                     mklbl('C', 4),
   ....:                                     mklbl('D', 2)])
   ....: 

In [48]: columns = pd.MultiIndex.from_tuples([('a', 'foo'), ('a', 'bar'),
   ....:                                      ('b', 'foo'), ('b', 'bah')],
   ....:                                     names=['lvl0', 'lvl1'])
   ....: 

In [49]: df = pd.DataFrame(np.arange(len(index) * len(columns)).reshape((len(index),
   ....:                   len(columns))),
   ....:                   index=index,
   ....:                   columns=columns).sort_index().sort_index(axis=1)
   ....: 

In [50]: df
Out[50]: 
lvl0           a         b     
lvl1         bar  foo  bah  foo
A0 B0 C0 D0    1    0    3    2
         D1    5    4    7    6
      C1 D0    9    8   11   10
         D1   13   12   15   14
      C2 D0   17   16   19   18
...          ...  ...  ...  ...
A3 B1 C1 D1  237  236  239  238
      C2 D0  241  240  243  242
         D1  245  244  247  246
      C3 D0  249  248  251  250
         D1  253  252  255  254

[64 rows x 4 columns]

使用切片、列表和标签的基本多索引切片。

In [51]: df.loc[(slice('A1', 'A3'), slice(None), ['C1', 'C3']), :]
Out[51]: 
lvl0           a         b     
lvl1         bar  foo  bah  foo
A1 B0 C1 D0   73   72   75   74
         D1   77   76   79   78
      C3 D0   89   88   91   90
         D1   93   92   95   94
   B1 C1 D0  105  104  107  106
...          ...  ...  ...  ...
A3 B0 C3 D1  221  220  223  222
   B1 C1 D0  233  232  235  234
         D1  237  236  239  238
      C3 D0  249  248  251  250
         D1  253  252  255  254

[24 rows x 4 columns]

您可以使用 pd.IndexSlice 要快速创建这些切片,请执行以下操作

In [52]: idx = pd.IndexSlice

In [53]: df.loc[idx[:, :, ['C1', 'C3']], idx[:, 'foo']]
Out[53]: 
lvl0           a    b
lvl1         foo  foo
A0 B0 C1 D0    8   10
         D1   12   14
      C3 D0   24   26
         D1   28   30
   B1 C1 D0   40   42
...          ...  ...
A3 B0 C3 D1  220  222
   B1 C1 D0  232  234
         D1  236  238
      C3 D0  248  250
         D1  252  254

[32 rows x 2 columns]

使用此方法可以同时在多个轴上执行非常复杂的选择。

In [54]: df.loc['A1', (slice(None), 'foo')]
Out[54]: 
lvl0        a    b
lvl1      foo  foo
B0 C0 D0   64   66
      D1   68   70
   C1 D0   72   74
      D1   76   78
   C2 D0   80   82
...       ...  ...
B1 C1 D1  108  110
   C2 D0  112  114
      D1  116  118
   C3 D0  120  122
      D1  124  126

[16 rows x 2 columns]

In [55]: df.loc[idx[:, :, ['C1', 'C3']], idx[:, 'foo']]
Out[55]: 
lvl0           a    b
lvl1         foo  foo
A0 B0 C1 D0    8   10
         D1   12   14
      C3 D0   24   26
         D1   28   30
   B1 C1 D0   40   42
...          ...  ...
A3 B0 C3 D1  220  222
   B1 C1 D0  232  234
         D1  236  238
      C3 D0  248  250
         D1  252  254

[32 rows x 2 columns]

使用布尔索引器,您可以提供与

In [56]: mask = df[('a', 'foo')] > 200

In [57]: df.loc[idx[mask, :, ['C1', 'C3']], idx[:, 'foo']]
Out[57]: 
lvl0           a    b
lvl1         foo  foo
A3 B0 C1 D1  204  206
      C3 D0  216  218
         D1  220  222
   B1 C1 D0  232  234
         D1  236  238
      C3 D0  248  250
         D1  252  254

[7 rows x 2 columns]

您还可以指定 axis 参数为 .loc 在单个轴上解释传递的切片器。

In [58]: df.loc(axis=0)[:, :, ['C1', 'C3']]
Out[58]: 
lvl0           a         b     
lvl1         bar  foo  bah  foo
A0 B0 C1 D0    9    8   11   10
         D1   13   12   15   14
      C3 D0   25   24   27   26
         D1   29   28   31   30
   B1 C1 D0   41   40   43   42
...          ...  ...  ...  ...
A3 B0 C3 D1  221  220  223  222
   B1 C1 D0  233  232  235  234
         D1  237  236  239  238
      C3 D0  249  248  251  250
         D1  253  252  255  254

[32 rows x 4 columns]

此外,您还可以 set 使用这些方法的值

In [59]: df2 = df.copy()

In [60]: df2.loc(axis=0)[:, :, ['C1', 'C3']] = -10

In [61]: df2
Out[61]: 
lvl0           a         b     
lvl1         bar  foo  bah  foo
A0 B0 C0 D0    1    0    3    2
         D1    5    4    7    6
      C1 D0  -10  -10  -10  -10
         D1  -10  -10  -10  -10
      C2 D0   17   16   19   18
...          ...  ...  ...  ...
A3 B1 C1 D1  -10  -10  -10  -10
      C2 D0  241  240  243  242
         D1  245  244  247  246
      C3 D0  -10  -10  -10  -10
         D1  -10  -10  -10  -10

[64 rows x 4 columns]

也可以使用可对齐对象的右侧。

In [62]: df2 = df.copy()

In [63]: df2.loc[idx[:, :, ['C1', 'C3']], :] = df2 * 1000

In [64]: df2
Out[64]: 
lvl0              a               b        
lvl1            bar     foo     bah     foo
A0 B0 C0 D0       1       0       3       2
         D1       5       4       7       6
      C1 D0    9000    8000   11000   10000
         D1   13000   12000   15000   14000
      C2 D0      17      16      19      18
...             ...     ...     ...     ...
A3 B1 C1 D1  237000  236000  239000  238000
      C2 D0     241     240     243     242
         D1     245     244     247     246
      C3 D0  249000  248000  251000  250000
         D1  253000  252000  255000  254000

[64 rows x 4 columns]

标绘#

  • Hexagonal bin plots from DataFrame.plot with kind='hexbin' (GH5478), See the docs.

  • DataFrame.plot and Series.plot now supports area plot with specifying kind='area' (GH6656), See the docs

  • Pie plots from Series.plot and DataFrame.plot with kind='pie' (GH6976), See the docs.

  • 现在,在中支持使用误差条绘图 .plot 一种方法 DataFrameSeries 对象 (GH3796GH6834 ),请参阅 the docs

  • DataFrame.plotSeries.plot 现在支持 table 用于绘图的关键词 matplotlib.Table ,请参阅 the docs 。这个 table 关键字可以接收下列值。

    • False :不执行任何操作(默认)。

    • True :使用以下命令绘制表格 DataFrameSeries 被叫 plot 方法。数据将被调换以满足matplotlib的默认布局。

    • DataFrameSeries :使用传递的数据绘制matplotlib.table。数据将按照Print方法显示的方式绘制(不会自动调换)。此外,Helper函数 pandas.tools.plotting.table 已添加以从中创建表 DataFrameSeries ,并将其添加到 matplotlib.Axes

  • plot(legend='reverse') 现在将反转大多数绘图类型的图例标签的顺序。 (GH6014 )

  • Line plot and area plot can be stacked by stacked=True (GH6656)

  • 以下关键字现在可用于 DataFrame.plot() 使用 kind='bar'kind='barh'

    • width :指定条宽。在以前的版本中,静态值0.5被传递给matplotlib,不能被覆盖。 (GH6604 )

    • align :指定条形对齐方式。默认值为 center (不同于matplotlib)。在以前的版本中,Pandas通过 align='edge' 设置为matplotlib并将位置调整为 center 它本身,它的结果是 align 关键字未按预期应用。 (GH4525 )

    • position :指定条形图布局的相对路线。从0(左/下端)到1(右/上端)。默认值为0.5(居中)。 (GH6604 )

    由于默认设置 align 值更改时,条形图的坐标现在位于整数值(0.0、1.0、2.0...)上。这是为了使条形图与线形图位于相同的坐标上。但是,手动调整条形图位置或绘图区域时,条形图可能会意外不同,例如使用 set_xlimset_ylim 在这种情况下,请修改您的脚本以满足新的坐标。

  • 这个 parallel_coordinates() 函数现在接受参数 color 而不是 colors 。一个 FutureWarning 被引发以警告旧的 colors 参数在将来的版本中将不受支持。 (GH6956 )

  • 这个 parallel_coordinates()andrews_curves() 函数现在接受位置参数 frame 而不是 data 。一个 FutureWarning 如果旧的 data 参数按名称使用。 (GH6956 )

  • DataFrame.boxplot() 现在支持 layout 关键字 (GH6769 )

  • DataFrame.boxplot() 有一个新的关键字参数, return_type 。它接受 'dict''axes' ,或 'both' ,在这种情况下,返回带有matplotlib轴和matplotlib行的DICT的命名元组。

先前版本的弃用/更改#

从0.14.0开始生效的是先前版本的弃用。

不推荐使用#

  • 这个 pivot_table()/DataFrame.pivot_table()crosstab() 函数现在接受参数 indexcolumns 而不是 rowscols 。一个 FutureWarning 被引发以警告旧的 rowscols 在将来的版本中将不支持参数 (GH5505 )

  • 这个 DataFrame.drop_duplicates()DataFrame.duplicated() 方法现在接受参数 subset 而不是 cols 更好地与 DataFrame.dropna() 。一个 FutureWarning 被引发以警告旧的 cols 在将来的版本中将不支持参数 (GH6680 )

  • 这个 DataFrame.to_csv()DataFrame.to_excel() 函数现在接受参数 columns 而不是 cols 。一个 FutureWarning 被引发以警告旧的 cols 在将来的版本中将不支持参数 (GH6645 )

  • 索引器将发出警告 FutureWarning 与标量索引器和非浮点索引一起使用时 (GH4892GH6960 )

    # non-floating point indexes can only be indexed by integers / labels
    In [1]: pd.Series(1, np.arange(5))[3.0]
            pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
    Out[1]: 1
    
    In [2]: pd.Series(1, np.arange(5)).iloc[3.0]
            pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
    Out[2]: 1
    
    In [3]: pd.Series(1, np.arange(5)).iloc[3.0:4]
            pandas/core/index.py:527: FutureWarning: slice indexers when using iloc should be integers and not floating point
    Out[3]:
            3    1
            dtype: int64
    
    # these are Float64Indexes, so integer or floating point is acceptable
    In [4]: pd.Series(1, np.arange(5.))[3]
    Out[4]: 1
    
    In [5]: pd.Series(1, np.arange(5.))[3.0]
    Out[6]: 1
    
  • Numpy 1.9 Comat W.r.t.不推荐使用警告 (GH6960 )

  • Panel.shift() 现在具有匹配的函数签名 DataFrame.shift() 。陈旧的立场论据 lags 已更改为关键字参数 periods 缺省值为1。a FutureWarning 如果旧的论点 lags 是按名称使用的。 (GH6910 )

  • 这个 order 的关键字参数 factorize() 将被移除。 (GH6926 )。

  • 移除 copy 关键字来源 DataFrame.xs()Panel.major_xs()Panel.minor_xs() 。如果可能,将返回视图,否则将创建副本。以前,用户可能会认为 copy=False 总是会返回一个视图。 (GH6894 )

  • 这个 parallel_coordinates() 函数现在接受参数 color 而不是 colors 。一个 FutureWarning 被引发以警告旧的 colors 参数在将来的版本中将不受支持。 (GH6956 )

  • 这个 parallel_coordinates()andrews_curves() 函数现在接受位置参数 frame 而不是 data 。一个 FutureWarning 如果旧的 data 参数按名称使用。 (GH6956 )

  • 使用DBAPI连接对象时对‘MySQL’风格的支持已弃用。MySQL将通过SQLAlChemy引擎得到进一步支持 (GH6900 )。

  • 以下内容 io.sql 函数已弃用: tqueryuqueryread_frameframe_querywrite_frame

  • 这个 percentile_width 中的关键字参数 describe() 已被弃用。使用 percentiles 关键字,该关键字获取要显示的百分位列表。默认输出不变。

  • 的默认返回类型 boxplot() 在未来的版本中将从Dict轴更改为matplotlib轴。您现在可以通过传递来使用将来的行为 return_type='axes' 到BOXPLATE。

已知问题#

  • OpenPyXL 2.0.0打破向后兼容性 (GH7169 )

增强#

  • DataFrame and Series will create a MultiIndex object if passed a tuples dict, See the docs (GH3323)

    In [65]: pd.Series({('a', 'b'): 1, ('a', 'a'): 0,
       ....:            ('a', 'c'): 2, ('b', 'a'): 3, ('b', 'b'): 4})
       ....: 
    Out[65]: 
    a  b    1
       a    0
       c    2
    b  a    3
       b    4
    Length: 5, dtype: int64
    
    In [66]: pd.DataFrame({('a', 'b'): {('A', 'B'): 1, ('A', 'C'): 2},
       ....:              ('a', 'a'): {('A', 'C'): 3, ('A', 'B'): 4},
       ....:              ('a', 'c'): {('A', 'B'): 5, ('A', 'C'): 6},
       ....:              ('b', 'a'): {('A', 'C'): 7, ('A', 'B'): 8},
       ....:              ('b', 'b'): {('A', 'D'): 9, ('A', 'B'): 10}})
       ....: 
    Out[66]: 
           a              b      
           b    a    c    a     b
    A B  1.0  4.0  5.0  8.0  10.0
      C  2.0  3.0  6.0  7.0   NaN
      D  NaN  NaN  NaN  NaN   9.0
    
    [3 rows x 5 columns]
    
  • Added the sym_diff method to Index (GH5543)

  • DataFrame.to_latex 现在接受Long Table关键字,如果为True,将在Long Table环境中返回一个表。 (GH6617 )

  • Add option to turn off escaping in DataFrame.to_latex (GH6472)

  • pd.read_clipboard Will,如果关键字 sep 未指定,请尝试检测从电子表格复制的数据并进行相应的解析。 (GH6223 )

  • 将单索引DataFrame与多索引DataFrame连接 (GH3662 )

    看见 the docs 。ATM尚不支持在左侧和右侧连接多索引数据帧。

    In [67]: household = pd.DataFrame({'household_id': [1, 2, 3],
       ....:                           'male': [0, 1, 0],
       ....:                           'wealth': [196087.3, 316478.7, 294750]
       ....:                           },
       ....:                          columns=['household_id', 'male', 'wealth']
       ....:                          ).set_index('household_id')
       ....: 
    
    In [68]: household
    Out[68]: 
                  male    wealth
    household_id                
    1                0  196087.3
    2                1  316478.7
    3                0  294750.0
    
    [3 rows x 2 columns]
    
    In [69]: portfolio = pd.DataFrame({'household_id': [1, 2, 2, 3, 3, 3, 4],
       ....:                           'asset_id': ["nl0000301109",
       ....:                                        "nl0000289783",
       ....:                                        "gb00b03mlx29",
       ....:                                        "gb00b03mlx29",
       ....:                                        "lu0197800237",
       ....:                                        "nl0000289965",
       ....:                                        np.nan],
       ....:                           'name': ["ABN Amro",
       ....:                                    "Robeco",
       ....:                                    "Royal Dutch Shell",
       ....:                                    "Royal Dutch Shell",
       ....:                                    "AAB Eastern Europe Equity Fund",
       ....:                                    "Postbank BioTech Fonds",
       ....:                                    np.nan],
       ....:                           'share': [1.0, 0.4, 0.6, 0.15, 0.6, 0.25, 1.0]
       ....:                           },
       ....:                          columns=['household_id', 'asset_id', 'name', 'share']
       ....:                          ).set_index(['household_id', 'asset_id'])
       ....: 
    
    In [70]: portfolio
    Out[70]: 
                                                         name  share
    household_id asset_id                                           
    1            nl0000301109                        ABN Amro   1.00
    2            nl0000289783                          Robeco   0.40
                 gb00b03mlx29               Royal Dutch Shell   0.60
    3            gb00b03mlx29               Royal Dutch Shell   0.15
                 lu0197800237  AAB Eastern Europe Equity Fund   0.60
                 nl0000289965          Postbank BioTech Fonds   0.25
    4            NaN                                      NaN   1.00
    
    [7 rows x 2 columns]
    
    In [71]: household.join(portfolio, how='inner')
    Out[71]: 
                               male    wealth                            name  share
    household_id asset_id                                                           
    1            nl0000301109     0  196087.3                        ABN Amro   1.00
    2            nl0000289783     1  316478.7                          Robeco   0.40
                 gb00b03mlx29     1  316478.7               Royal Dutch Shell   0.60
    3            gb00b03mlx29     0  294750.0               Royal Dutch Shell   0.15
                 lu0197800237     0  294750.0  AAB Eastern Europe Equity Fund   0.60
                 nl0000289965     0  294750.0          Postbank BioTech Fonds   0.25
    
    [6 rows x 4 columns]
    
  • quotechar, doublequote, and escapechar can now be specified when using DataFrame.to_csv (GH5414, GH4528)

  • 属性仅按多重索引的指定级别进行部分排序 sort_remaining 布尔科克人。 (GH3984 )

  • 已添加 to_julian_dateTimeStampDatetimeIndex 。儒略日期主要用于天文学,表示从公元前4713年1月1日中午开始的天数。因为在Pandas中使用纳秒来定义时间,所以您可以使用的实际日期范围是公元1678年到公元2262年。 (GH4041 )

  • DataFrame.to_stata 现在将检查数据与Stata数据类型的兼容性,并在需要时向上转换。当不可能无损地向上投射时,发出警告 (GH6327 )

  • DataFrame.to_stataStataWriter 将接受关键字参数TIME_STAMP和DATA_LABEL,它们允许在创建文件时设置时间戳和数据集标签。 (GH6545 )

  • pandas.io.gbq 现在可以正确处理读取Unicode字符串。 (GH5940 )

  • Holidays Calendars 现已可用,并可与 CustomBusinessDay 偏移 (GH6719 )

  • Float64Index 现在得到了一个 float64 Dtype ndarray而不是 object 数据类型数组 (GH6471 )。

  • Implemented Panel.pct_change (GH6904)

  • 已添加 how 滚动力矩函数的选项,指示如何处理重采样; rolling_max() 默认为最大值, rolling_min() 缺省值为MIN,所有其他值缺省为Mean (GH6297 )

  • CustomBusinessMonthBeginCustomBusinessMonthEnd 现已推出 (GH6866 )

  • Series.quantile()DataFrame.quantile() 现在接受一个分位数数组。

  • describe() 现在接受要包括在摘要统计信息中的百分位数组 (GH4196 )

  • pivot_table 现在可以接受 Grouper 通过 indexcolumns 关键词 (GH6913 )

    In [72]: import datetime
    
    In [73]: df = pd.DataFrame({
       ....:     'Branch': 'A A A A A B'.split(),
       ....:     'Buyer': 'Carl Mark Carl Carl Joe Joe'.split(),
       ....:     'Quantity': [1, 3, 5, 1, 8, 1],
       ....:     'Date': [datetime.datetime(2013, 11, 1, 13, 0),
       ....:              datetime.datetime(2013, 9, 1, 13, 5),
       ....:              datetime.datetime(2013, 10, 1, 20, 0),
       ....:              datetime.datetime(2013, 10, 2, 10, 0),
       ....:              datetime.datetime(2013, 11, 1, 20, 0),
       ....:              datetime.datetime(2013, 10, 2, 10, 0)],
       ....:     'PayDay': [datetime.datetime(2013, 10, 4, 0, 0),
       ....:                datetime.datetime(2013, 10, 15, 13, 5),
       ....:                datetime.datetime(2013, 9, 5, 20, 0),
       ....:                datetime.datetime(2013, 11, 2, 10, 0),
       ....:                datetime.datetime(2013, 10, 7, 20, 0),
       ....:                datetime.datetime(2013, 9, 5, 10, 0)]})
       ....: 
    
    In [74]: df
    Out[74]: 
      Branch Buyer  Quantity                Date              PayDay
    0      A  Carl         1 2013-11-01 13:00:00 2013-10-04 00:00:00
    1      A  Mark         3 2013-09-01 13:05:00 2013-10-15 13:05:00
    2      A  Carl         5 2013-10-01 20:00:00 2013-09-05 20:00:00
    3      A  Carl         1 2013-10-02 10:00:00 2013-11-02 10:00:00
    4      A   Joe         8 2013-11-01 20:00:00 2013-10-07 20:00:00
    5      B   Joe         1 2013-10-02 10:00:00 2013-09-05 10:00:00
    
    [6 rows x 5 columns]
    
    In [75]: df.pivot_table(values='Quantity',
       ....:                index=pd.Grouper(freq='M', key='Date'),
       ....:                columns=pd.Grouper(freq='M', key='PayDay'),
       ....:                aggfunc=np.sum)
       ....: 
    Out[75]: 
    PayDay      2013-09-30  2013-10-31  2013-11-30
    Date                                          
    2013-09-30         NaN         3.0         NaN
    2013-10-31         6.0         NaN         1.0
    2013-11-30         NaN         9.0         NaN
    
    [3 rows x 3 columns]
    
  • 字符串数组可以换行到指定的宽度 (str.wrap ) (GH6999 )

  • Add nsmallest() and Series.nlargest() methods to Series, See the docs (GH3960)

  • PeriodIndex fully supports partial string indexing like DatetimeIndex (GH7043)

    In [76]: prng = pd.period_range('2013-01-01 09:00', periods=100, freq='H')
    
    In [77]: ps = pd.Series(np.random.randn(len(prng)), index=prng)
    
    In [78]: ps
    Out[78]: 
    2013-01-01 09:00    0.015696
    2013-01-01 10:00   -2.242685
    2013-01-01 11:00    1.150036
    2013-01-01 12:00    0.991946
    2013-01-01 13:00    0.953324
                          ...   
    2013-01-05 08:00    0.285296
    2013-01-05 09:00    0.484288
    2013-01-05 10:00    1.363482
    2013-01-05 11:00   -0.781105
    2013-01-05 12:00   -0.468018
    Freq: H, Length: 100, dtype: float64
    
    In [79]: ps['2013-01-02']
    Out[79]: 
    2013-01-02 00:00    0.553439
    2013-01-02 01:00    1.318152
    2013-01-02 02:00   -0.469305
    2013-01-02 03:00    0.675554
    2013-01-02 04:00   -1.817027
                          ...   
    2013-01-02 19:00    0.036142
    2013-01-02 20:00   -2.074978
    2013-01-02 21:00    0.247792
    2013-01-02 22:00   -0.897157
    2013-01-02 23:00   -0.136795
    Freq: H, Length: 24, dtype: float64
    
  • read_excel 现在可以读取xlrd>=0.9.3的Excel日期和时间中的毫秒数。 (GH5945 )

  • pd.stats.moments.rolling_var 现在使用韦尔福德方法来提高数值稳定性 (GH6817 )

  • Pd.expanding_Apply和pd.Rolling_Apply现在接受传递给函数的参数和kwarg (GH6289 )

  • DataFrame.rank() 现在有一个百分比排名选项 (GH5971 )

  • Series.rank() 现在有一个百分比排名选项 (GH5971 )

  • Series.rank()DataFrame.rank() 现在接受 method='dense' 对于没有差距的级别 (GH6514 )

  • 支撑传球 encoding 使用xlwt (GH3710 )

  • 重构块类删除 Block.items 属性以避免项处理中的重复 (GH6745GH6988 )。

  • 测试语句更新为使用专门的断言 (GH6175 )

性能#

  • Performance improvement when converting DatetimeIndex to floating ordinals using DatetimeConverter (GH6636)

  • Performance improvement for DataFrame.shift (GH5609)

  • 索引到多索引序列的性能改进 (GH5567 )

  • 单类型索引的性能改进 (GH6484 )

  • 通过移除有问题的缓存(例如MonthEnd、BusinessMonthEnd),使用某些偏移量提高DataFrame构造的性能, (GH6479 )

  • Improve performance of CustomBusinessDay (GH6584)

  • 提高具有字符串键的序列的切片索引性能 (GH6341GH6372 )

  • 性能提升 DataFrame.from_records 从可迭代对象中读取指定数量的行时 (GH6700 )

  • 整型数据类型的时间增量转换的性能改进 (GH6754 )

  • 改善了兼容泡菜的性能 (GH6899 )

  • Improve performance in certain reindexing operations by optimizing take_2d (GH6749)

  • GroupBy.count() 现在用Cython语言实现,对于大量的组来说要快得多 (GH7016 )。

实验性的#

0.14.0中没有实验上的变化

错误修复#

  • 当索引与数据不匹配时,序列ValueError中出现错误 (GH6532 )

  • 防止由于HDFStore表格式不支持多索引而导致的段错误 (GH1848 )

  • Bug in pd.DataFrame.sort_index where mergesort wasn't stable when ascending=False (GH6399)

  • 窃听 pd.tseries.frequencies.to_offset 当参数具有前导零时 (GH6391 )

  • 版本字符串生成中的错误。对于带有浅克隆的开发版本/从tarball安装 (GH6127 )

  • 不一致的TZ解析 Timestamp / to_datetime 本年度的 (GH5958 )

  • 使用重新排序的索引的索引错误 (GH6252GH6254 )

  • 窃听 .xs 使用系列多索引 (GH6258GH5684 )

  • 将字符串类型转换为指定频率的DatetimeIndex时出错 (GH6273GH6274 )

  • 窃听 eval 对于大型表达式,类型提升失败 (GH6205 )

  • Bug in interpolate with inplace=True (GH6281)

  • HDFStore.remove 现在处理启动和停止 (GH6177 )

  • HDFStore.select_as_multiple handles start and stop the same way as select (GH6177)

  • HDFStore.select_as_coordinatesselect_columnwhere 产生过滤器的子句 (GH6177 )

  • Non_Unique_INDEX连接中的回归 (GH6329 )

  • GROUPBY问题 agg 具有单一功能和混合型框架 (GH6337 )

  • 窃听 DataFrame.replace() 当通过一个非- bool to_replace 论据 (GH6332 )

  • 尝试在多索引赋值的不同级别对齐时引发 (GH3738 )

  • 通过布尔索引设置复杂数据类型时出错 (GH6345 )

  • 当显示返回无效结果的非单调DatetimeIndex时,TimeGrouper/Resample中出现错误。 (GH4161 )

  • TimeGrouper/Resample中的索引名称传播错误 (GH4161 )

  • TimeGrouper有一个与其他Grouper更兼容的API(例如 groups 失踪) (GH3881 )

  • 根据目标列顺序使用TimeGrouper进行多个分组时出现错误 (GH6764 )

  • Bug in pd.eval when parsing strings with possible tokens like '&' (GH6351)

  • 错误正确地处理 -inf 在面板中除以整数0时 (GH6178 )

  • DataFrame.shift 使用 axis=1 是在提高 (GH6371 )

  • 在发布前禁用剪贴板测试(在本地运行 nosetests -A disabled ) (GH6048 )。

  • 窃听 DataFrame.replace() 在传递嵌套的 dict 包含不在要替换的值中的键的 (GH6342 )

  • str.match 忽略NA标志 (GH6609 )。

  • 接受未合并的重复列时出现错误 (GH6240 )

  • 内插更改数据类型时出现错误 (GH6290 )

  • 窃听 Series.get ,正在使用一种错误的访问方法 (GH6383 )

  • Bug in hdfstore queries of the form where=[('date', '>=', datetime(2013,1,1)), ('date', '<=', datetime(2014,1,1))] (GH6313)

  • 窃听 DataFrame.dropna 具有重复索引 (GH6355 )

  • 基于0.12的链式地物索引中的回归分析 (GH6394 )

  • Float64Index NAN不能正确比较 (GH6401 )

  • eval/query 包含字符串的表达式 @ 角色现在可以工作了 (GH6366 )。

  • 窃听 Series.reindex 在指定 method 与某些NaN值不一致(在重新采样中注明) (GH6418 )

  • 窃听 DataFrame.replace() 根据字典键和值的顺序,嵌套的字典是错误的 (GH5338 )。

  • 连接空对象时的性能问题 (GH3259 )

  • 澄清分类 sym_diff 在……上面 Index 对象具有 NaN 值 (GH6444 )

  • 回归到 MultiIndex.from_product 使用一个 DatetimeIndex 作为输入 (GH6439 )

  • 窃听 str.extract 传递非默认索引时 (GH6348 )

  • Bug in str.split when passed pat=None and n=1 (GH6466)

  • Bug in io.data.DataReader when passed "F-F_Momentum_Factor" and data_source="famafrench" (GH6460)

  • 窃听 sum 属于 timedelta64[ns] 系列 (GH6462 )

  • 窃听 resample 带有时区和某些偏移量 (GH6397 )

  • 窃听 iat/iloc 具有系列上的重复索引 (GH6493 )

  • 窃听 read_html 错误地使用NaN来指示文本中的缺失值。应该使用空字符串与其他Pandas保持一致 (GH5129 )。

  • 窃听 read_html 重定向无效URL会导致一次测试失败的测试 (GH6445 )。

  • 使用多轴索引时出现错误 .loc 关于非唯一指数 (GH6504 )

  • 在DataFrame的列轴上建立切片索引时导致_ref_Locs损坏的错误 (GH6525 )

  • 麻木治疗的回归系数为0.13 datetime64 系列创作中的非ns数据类型 (GH6529 )

  • .names 传递给的多索引的属性 set_index 现已保存下来 (GH6459 )。

  • 具有重复索引和可对齐RHS的集合中的错误 (GH6541 )

  • 在Stitem中安装错误 .loc 关于混合整数指数 (GH6546 )

  • 窃听 pd.read_stata 它会使用错误的数据类型和缺失值 (GH6327 )

  • 窃听 DataFrame.to_stata 这在某些情况下会导致数据丢失,并且可能会使用错误的数据类型和缺失的值进行导出 (GH6335 )

  • StataWriter 将字符串列中缺少的值替换为空字符串 (GH6802 )

  • 中的类型不一致 Timestamp 加/减 (GH6543 )

  • 跨时间戳加/减保持频率错误 (GH4547 )

  • 空列表查找中出现错误 IndexError 例外 (GH6536GH6551 )

  • Series.quantile 在一个人的身上提高 object 数据类型 (GH6555 )

  • 窃听 .xs 使用一个 nan 在下降时处于水平 (GH6574 )

  • 在填充物中安装错误 method='bfill/ffill'datetime64[ns] 数据类型 (GH6587 )

  • 使用混合数据类型编写SQL时出现错误,可能导致数据丢失 (GH6509 )

  • Bug in Series.pop (GH6600)

  • 窃听 iloc 位置索引器匹配时进行索引 Int64Index ,并且没有发生重新排序 (GH6612 )

  • 窃听 fillna 使用 limitvalue 指定

  • 窃听 DataFrame.to_stata 当列具有非字符串名称时 (GH4558 )

  • 与之相容的错误 np.compress ,出现在 (GH6658 )

  • 序列的RHS不对齐的二进制操作中的错误 (GH6681 )

  • 窃听 DataFrame.to_stata ,它错误地处理NaN值并忽略 with_index 关键字参数 (GH6685 )

  • 使用均匀可分频率时,使用额外的箱进行重新采样时出现错误 (GH4076 )

  • 传递自定义函数时GROUPBY聚合的一致性错误 (GH6715 )

  • 重新采样时出现错误 how=None 重采样频率与轴频率相同 (GH5955 )

  • 使用空数组向下转换推理时出现错误 (GH6733 )

  • 窃听 obj.blocks 在稀疏容器上为dtype删除除最后一项以外的所有相同项 (GH6748 )

  • Bug in unpickling NaT (NaTType) (GH4606)

  • Bug in DataFrame.replace() where regex meta characters were being treated as regex even when regex=False (GH6777).

  • 32位平台上的Time Delta操作中的错误 (GH6808 )

  • Bug in setting a tz-aware index directly via .index (GH6785)

  • Pressions.py中的错误,其中numexpr将尝试计算算术运算 (GH6762 )。

  • Bug in Makefile where it didn't remove Cython generated C files with make clean (GH6768)

  • Bug with numpy < 1.7.2 when reading long strings from HDFStore (GH6166)

  • 窃听 DataFrame._reduce 其中非类布尔(0/1)整数被转换为布尔。 (GH6806 )

  • 从0.13开始回归 fillna 和一个关于约会时间的系列节目 (GH6344 )

  • 添加时出现错误 np.timedelta64DatetimeIndex 使用时区输出的结果不正确 (GH6818 )

  • 窃听 DataFrame.replace() 其中,通过替换更改数据类型只会替换值的第一次出现 (GH6689 )

  • 在传入频率为“MS”时出现更好的错误消息 Period 建造业(GH5332)

  • 窃听 Series.__unicode__ 什么时候 max_rows=None 该系列有1000多行。 (GH6863 )

  • 窃听 groupby.get_group 在那里,约会并不总是被接受的 (GH5267 )

  • Bug in groupBy.get_group created by TimeGrouper raises AttributeError (GH6914)

  • 窃听 DatetimeIndex.tz_localizeDatetimeIndex.tz_convert 转换 NaT 不正确 (GH5546 )

  • Bug in arithmetic operations affecting NaT (GH6873)

  • 窃听 Series.str.extract 其中所产生的 Series 来自单个组的匹配项未重命名为组名

  • 窃听 DataFrame.to_csv Where设置 index=False 忽略了 header 科瓦格 (GH6186 )

  • 窃听 DataFrame.plotSeries.plot ,其中图例在重复打印到相同轴时行为不一致 (GH6678 )

  • 打补丁的内部测试 __finalize__ /BUG合并未完成 (GH6923GH6927 )

  • 接受 TextFileReader 在……里面 concat ,这影响了一个常见的用户习惯用法 (GH6583 )

  • 带有前导空格的C解析器中存在错误 (GH3374 )

  • C解析器中的错误 delim_whitespace=True\r -分隔行

  • 在列标题后的行中显式多索引的Python解析器中存在错误 (GH6893 )

  • 窃听 Series.rankDataFrame.rank 这导致较小的浮点数(<1e-13)都获得相同的排名 (GH6886 )

  • 窃听 DataFrame.apply 使用的函数使用 *args**kwargs 并返回空结果 (GH6952 )

  • 溢出的32位平台上的总和/平均值错误 (GH6915 )

  • 感动了 Panel.shiftNDFrame.slice_shift 并修复为支持多个数据类型。 (GH6959 )

  • Bug in enabling subplots=True in DataFrame.plot only has single column raises TypeError, and Series.plot raises AttributeError (GH6951)

  • Bug in DataFrame.plot draws unnecessary axes when enabling subplots and kind=scatter (GH6951)

  • 窃听 read_csv 来自非UTF-8编码的文件系统 (GH6807 )

  • 窃听 iloc 设置/对齐时 (GH6766 )

  • 使用Unicode值和前缀调用Get_Dummies时导致UnicodeEncodeError的错误 (GH6885 )

  • 带有频率的时间序列绘图光标显示中的错误 (GH5453 )

  • Bug surfaced in groupby.plot when using a Float64Index (GH7025)

  • 已停止在无法从Yahoo下载选项数据的情况下测试失败 (GH7034 )

  • 窃听 parallel_coordinatesradviz 类列的重新排序可能导致颜色/类不匹配 (GH6956 )

  • 窃听 radvizandrews_curves 其中将多个‘COLOR’值传递给绘图方法 (GH6956 )

  • 窃听 Float64Index.isin() 其中包含 nan S会让索引声称它们包含了所有的东西 (GH7066 )。

  • 窃听 DataFrame.boxplot 其中,它未能使用作为 ax 论据 (GH3578 )

  • Bug in the XlsxWriterXlwtWriter 导致在没有时间的情况下格式化日期时间列的实现 (GH7075 )正在传递给绘图方法

  • read_fwf() 招待 None 在……里面 colspec 就像普通的 Python 切片一样。现在,它将从行首或行尾开始读取 colspec 包含一个 None (之前提出了一个 TypeError )

  • 使用链式索引和切片的缓存一致性错误;添加 _is_view 属性设置为 NDFrame 正确地预测观点;标记 is_copy 在……上面 xs 仅当它是实际副本(而不是视图)时 (GH7084 )

  • Bug in DatetimeIndex creation from string ndarray with dayfirst=True (GH5917)

  • Bug in MultiIndex.from_arrays created from DatetimeIndex doesn't preserve freq and tz (GH7090)

  • Bug in unstack raises ValueError when MultiIndex contains PeriodIndex (GH4342)

  • 窃听 boxplothist 绘制不必要的轴 (GH6769 )

  • 回归到 groupby.nth() 对于超出范围的索引器 (GH6621 )

  • 窃听 quantile 使用日期时间值 (GH6965 )

  • 窃听 Dataframe.set_indexreindexpivot 不要保存 DatetimeIndexPeriodIndex 属性 (GH3950GH5878GH6631 )

  • 窃听 MultiIndex.get_level_values 不能保存 DatetimeIndexPeriodIndex 属性 (GH7092 )

  • Bug in Groupby doesn't preserve tz (GH3950)

  • 窃听 PeriodIndex 部分字符串切片 (GH6716 )

  • 截断的Series或DataFrame的HTMLepr中存在错误,不显示带有 large_repr 设置为‘INFO’ (GH7105 )

  • 窃听 DatetimeIndex 指定 freq 加薪 ValueError 当传递的值太短时 (GH7098 )

  • 修复了使用 info Repr不遵守 display.max_info_columns 设置 (GH6939 )

  • 虫虫 PeriodIndex 具有越界值的字符串切片 (GH5407 )

  • 修复了调整大表大小时哈希表实现/因式分解程序中的内存错误 (GH7157 )

  • 窃听 isnull 应用于0维对象数组时 (GH7176 )

  • 窃听 query/eval 未正确查找全局常量的位置 (GH7178 )

  • 识别超出范围的位置列表索引器时出错 iloc 和多轴元组索引器 (GH7189 )

  • 具有单值、多索引和整数索引的集合中存在错误 (GH7190GH7218 )

  • 使用反向运算的表达式求值中的错误,显示在系列-dataframe运算中 (GH7198GH7192 )

  • 使用>2 ndim和多索引的多轴索引中的错误 (GH7199 )

  • 修复了无效的计算/查询操作会导致堆栈崩溃的错误 (GH5198 )

贡献者#

共有94人为此次发布贡献了补丁。名字中带有“+”的人第一次贡献了一个补丁。

  • Acanthostega +

  • Adam Marcus +

  • Alex Gaudio

  • Alex Rothberg

  • AllenDowney +

  • Andrew Rosenfeld +

  • Andy Hayden

  • Antoine Mazières +

  • Benedikt Sauer

  • Brad Buran

  • Christopher Whelan

  • Clark Fitzgerald

  • DSM

  • Dale Jung

  • Dan Allan

  • Dan Birken

  • Daniel Waeber

  • David Jung +

  • David Stephens +

  • Douglas McNeil

  • Garrett Drapala

  • Gouthaman Balaraman +

  • Guillaume Poulin +

  • Jacob Howard +

  • Jacob Schaer

  • Jason Sexauer +

  • Jeff Reback

  • Jeff Tratner

  • Jeffrey Starr +

  • John David Reaver +

  • John McNamara

  • John W. O'Brien

  • Jonathan Chambers

  • Joris Van den Bossche

  • Julia Evans

  • Júlio +

  • K.-Michael Aye

  • Katie Atkinson +

  • Kelsey Jordahl

  • Kevin Sheppard +

  • Matt Wittmann +

  • Matthias Kuhn +

  • Max Grender-Jones +

  • Michael E. Gruen +

  • Mike Kelly

  • Nipun Batra +

  • Noah Spies +

  • PKEuS

  • Patrick O'Keeffe

  • Phillip Cloud

  • Pietro Battiston +

  • Randy Carnevale +

  • Robert Gibboni +

  • Skipper Seabold

  • SplashDance +

  • Stephan Hoyer +

  • Tim Cera +

  • Tobias Brandt

  • Todd Jennings +

  • Tom Augspurger

  • TomAugspurger

  • Yaroslav Halchenko

  • agijsberts +

  • akittredge

  • ankostis +

  • anomrake

  • anton-d +

  • bashtage +

  • benjamin +

  • bwignall

  • cgohlke +

  • chebee7i +

  • clham +

  • danielballan

  • hshimizu77 +

  • hugo +

  • immerrr

  • ischwabacher +

  • jaimefrio +

  • jreback

  • jsexauer +

  • kdiether +

  • michaelws +

  • mikebailey +

  • ojdo +

  • onesandzeroes +

  • phaebz +

  • ribonoous +

  • rockg

  • sinhrks +

  • unutbu

  • westurner

  • y-p

  • zach powers