1.. _whatsnew_0180:
2
3Version 0.18.0 (March 13, 2016)
4-------------------------------
5
6{{ header }}
7
8
9This is a major release from 0.17.1 and includes a small number of API changes, several new features,
10enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
11users upgrade to this version.
12
13.. warning::
14
15   pandas >= 0.18.0 no longer supports compatibility with Python version 2.6
16   and 3.3 (:issue:`7718`, :issue:`11273`)
17
18.. warning::
19
20   ``numexpr`` version 2.4.4 will now show a warning and not be used as a computation back-end for pandas because of some buggy behavior. This does not affect other versions (>= 2.1 and >= 2.4.6). (:issue:`12489`)
21
22Highlights include:
23
24- Moving and expanding window functions are now methods on Series and DataFrame,
25  similar to ``.groupby``, see :ref:`here <whatsnew_0180.enhancements.moments>`.
26- Adding support for a ``RangeIndex`` as a specialized form of the ``Int64Index``
27  for memory savings, see :ref:`here <whatsnew_0180.enhancements.rangeindex>`.
28- API breaking change to the ``.resample`` method to make it more ``.groupby``
29  like, see :ref:`here <whatsnew_0180.breaking.resample>`.
30- Removal of support for positional indexing with floats, which was deprecated
31  since 0.14.0. This will now raise a ``TypeError``, see :ref:`here <whatsnew_0180.float_indexers>`.
32- The ``.to_xarray()`` function has been added for compatibility with the
33  `xarray package <http://xarray.pydata.org/en/stable/>`__, see :ref:`here <whatsnew_0180.enhancements.xarray>`.
34- The ``read_sas`` function has been enhanced to read ``sas7bdat`` files, see :ref:`here <whatsnew_0180.enhancements.sas>`.
35- Addition of the :ref:`.str.extractall() method <whatsnew_0180.enhancements.extract>`,
36  and API changes to the :ref:`.str.extract() method <whatsnew_0180.enhancements.extract>`
37  and :ref:`.str.cat() method <whatsnew_0180.enhancements.strcat>`.
38- ``pd.test()`` top-level nose test runner is available (:issue:`4327`).
39
40Check the :ref:`API Changes <whatsnew_0180.api_breaking>` and :ref:`deprecations <whatsnew_0180.deprecations>` before updating.
41
42.. contents:: What's new in v0.18.0
43    :local:
44    :backlinks: none
45
46.. _whatsnew_0180.enhancements:
47
48New features
49~~~~~~~~~~~~
50
51.. _whatsnew_0180.enhancements.moments:
52
53Window functions are now methods
54^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55
56Window functions have been refactored to be methods on ``Series/DataFrame`` objects, rather than top-level functions, which are now deprecated. This allows these window-type functions, to have a similar API to that of ``.groupby``. See the full documentation :ref:`here <window.overview>` (:issue:`11603`, :issue:`12373`)
57
58
59.. ipython:: python
60
61   np.random.seed(1234)
62   df = pd.DataFrame({'A': range(10), 'B': np.random.randn(10)})
63   df
64
65Previous behavior:
66
67.. code-block:: ipython
68
69   In [8]: pd.rolling_mean(df, window=3)
70           FutureWarning: pd.rolling_mean is deprecated for DataFrame and will be removed in a future version, replace with
71                          DataFrame.rolling(window=3,center=False).mean()
72   Out[8]:
73       A         B
74   0 NaN       NaN
75   1 NaN       NaN
76   2   1  0.237722
77   3   2 -0.023640
78   4   3  0.133155
79   5   4 -0.048693
80   6   5  0.342054
81   7   6  0.370076
82   8   7  0.079587
83   9   8 -0.954504
84
85New behavior:
86
87.. ipython:: python
88
89   r = df.rolling(window=3)
90
91These show a descriptive repr
92
93.. ipython:: python
94
95   r
96with tab-completion of available methods and properties.
97
98.. code-block:: ipython
99
100   In [9]: r.<TAB>  # noqa E225, E999
101   r.A           r.agg         r.apply       r.count       r.exclusions  r.max         r.median      r.name        r.skew        r.sum
102   r.B           r.aggregate   r.corr        r.cov         r.kurt        r.mean        r.min         r.quantile    r.std         r.var
103
104The methods operate on the ``Rolling`` object itself
105
106.. ipython:: python
107
108   r.mean()
109
110They provide getitem accessors
111
112.. ipython:: python
113
114   r['A'].mean()
115
116And multiple aggregations
117
118.. ipython:: python
119
120   r.agg({'A': ['mean', 'std'],
121          'B': ['mean', 'std']})
122
123.. _whatsnew_0180.enhancements.rename:
124
125Changes to rename
126^^^^^^^^^^^^^^^^^
127
128``Series.rename`` and ``NDFrame.rename_axis`` can now take a scalar or list-like
129argument for altering the Series or axis *name*, in addition to their old behaviors of altering labels. (:issue:`9494`, :issue:`11965`)
130
131.. ipython:: python
132
133   s = pd.Series(np.random.randn(5))
134   s.rename('newname')
135
136.. ipython:: python
137
138   df = pd.DataFrame(np.random.randn(5, 2))
139   (df.rename_axis("indexname")
140      .rename_axis("columns_name", axis="columns"))
141
142The new functionality works well in method chains. Previously these methods only accepted functions or dicts mapping a *label* to a new label.
143This continues to work as before for function or dict-like values.
144
145
146.. _whatsnew_0180.enhancements.rangeindex:
147
148Range Index
149^^^^^^^^^^^
150
151A ``RangeIndex`` has been added to the ``Int64Index`` sub-classes to support a memory saving alternative for common use cases. This has a similar implementation to the python ``range`` object (``xrange`` in python 2), in that it only stores the start, stop, and step values for the index. It will transparently interact with the user API, converting to ``Int64Index`` if needed.
152
153This will now be the default constructed index for ``NDFrame`` objects, rather than previous an ``Int64Index``. (:issue:`939`, :issue:`12070`, :issue:`12071`, :issue:`12109`, :issue:`12888`)
154
155Previous behavior:
156
157.. code-block:: ipython
158
159   In [3]: s = pd.Series(range(1000))
160
161   In [4]: s.index
162   Out[4]:
163   Int64Index([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
164               ...
165               990, 991, 992, 993, 994, 995, 996, 997, 998, 999], dtype='int64', length=1000)
166
167   In [6]: s.index.nbytes
168   Out[6]: 8000
169
170
171New behavior:
172
173.. ipython:: python
174
175   s = pd.Series(range(1000))
176   s.index
177   s.index.nbytes
178
179.. _whatsnew_0180.enhancements.extract:
180
181Changes to str.extract
182^^^^^^^^^^^^^^^^^^^^^^
183
184The :ref:`.str.extract <text.extract>` method takes a regular
185expression with capture groups, finds the first match in each subject
186string, and returns the contents of the capture groups
187(:issue:`11386`).
188
189In v0.18.0, the ``expand`` argument was added to
190``extract``.
191
192- ``expand=False``: it returns a ``Series``, ``Index``, or ``DataFrame``, depending on the subject and regular expression pattern (same behavior as pre-0.18.0).
193- ``expand=True``: it always returns a ``DataFrame``, which is more consistent and less confusing from the perspective of a user.
194
195Currently the default is ``expand=None`` which gives a ``FutureWarning`` and uses ``expand=False``. To avoid this warning, please explicitly specify ``expand``.
196
197.. code-block:: ipython
198
199   In [1]: pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=None)
200   FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame)
201   but in a future version of pandas this will be changed to expand=True (return DataFrame)
202
203   Out[1]:
204   0      1
205   1      2
206   2    NaN
207   dtype: object
208
209Extracting a regular expression with one group returns a Series if
210``expand=False``.
211
212.. ipython:: python
213
214   pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=False)
215
216It returns a ``DataFrame`` with one column if ``expand=True``.
217
218.. ipython:: python
219
220   pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=True)
221
222Calling on an ``Index`` with a regex with exactly one capture group
223returns an ``Index`` if ``expand=False``.
224
225.. ipython:: python
226
227   s = pd.Series(["a1", "b2", "c3"], ["A11", "B22", "C33"])
228   s.index
229   s.index.str.extract("(?P<letter>[a-zA-Z])", expand=False)
230
231It returns a ``DataFrame`` with one column if ``expand=True``.
232
233.. ipython:: python
234
235   s.index.str.extract("(?P<letter>[a-zA-Z])", expand=True)
236
237Calling on an ``Index`` with a regex with more than one capture group
238raises ``ValueError`` if ``expand=False``.
239
240.. code-block:: python
241
242    >>> s.index.str.extract("(?P<letter>[a-zA-Z])([0-9]+)", expand=False)
243    ValueError: only one regex group is supported with Index
244
245It returns a ``DataFrame`` if ``expand=True``.
246
247.. ipython:: python
248
249   s.index.str.extract("(?P<letter>[a-zA-Z])([0-9]+)", expand=True)
250
251In summary, ``extract(expand=True)`` always returns a ``DataFrame``
252with a row for every subject string, and a column for every capture
253group.
254
255.. _whatsnew_0180.enhancements.extractall:
256
257Addition of str.extractall
258^^^^^^^^^^^^^^^^^^^^^^^^^^
259
260The :ref:`.str.extractall <text.extractall>` method was added
261(:issue:`11386`).  Unlike ``extract``, which returns only the first
262match.
263
264.. ipython:: python
265
266   s = pd.Series(["a1a2", "b1", "c1"], ["A", "B", "C"])
267   s
268   s.str.extract(r"(?P<letter>[ab])(?P<digit>\d)", expand=False)
269
270The ``extractall`` method returns all matches.
271
272.. ipython:: python
273
274   s.str.extractall(r"(?P<letter>[ab])(?P<digit>\d)")
275
276.. _whatsnew_0180.enhancements.strcat:
277
278Changes to str.cat
279^^^^^^^^^^^^^^^^^^
280
281The method ``.str.cat()`` concatenates the members of a ``Series``. Before, if ``NaN`` values were present in the Series, calling ``.str.cat()`` on it would return ``NaN``, unlike the rest of the ``Series.str.*`` API. This behavior has been amended to ignore ``NaN`` values by default. (:issue:`11435`).
282
283A new, friendlier ``ValueError`` is added to protect against the mistake of supplying the ``sep`` as an arg, rather than as a kwarg. (:issue:`11334`).
284
285.. ipython:: python
286
287    pd.Series(['a', 'b', np.nan, 'c']).str.cat(sep=' ')
288    pd.Series(['a', 'b', np.nan, 'c']).str.cat(sep=' ', na_rep='?')
289
290.. code-block:: ipython
291
292    In [2]: pd.Series(['a', 'b', np.nan, 'c']).str.cat(' ')
293    ValueError: Did you mean to supply a ``sep`` keyword?
294
295
296.. _whatsnew_0180.enhancements.rounding:
297
298Datetimelike rounding
299^^^^^^^^^^^^^^^^^^^^^
300
301``DatetimeIndex``, ``Timestamp``, ``TimedeltaIndex``, ``Timedelta`` have gained the ``.round()``, ``.floor()`` and ``.ceil()`` method for datetimelike rounding, flooring and ceiling. (:issue:`4314`, :issue:`11963`)
302
303Naive datetimes
304
305.. ipython:: python
306
307   dr = pd.date_range('20130101 09:12:56.1234', periods=3)
308   dr
309   dr.round('s')
310
311   # Timestamp scalar
312   dr[0]
313   dr[0].round('10s')
314
315Tz-aware are rounded, floored and ceiled in local times
316
317.. ipython:: python
318
319   dr = dr.tz_localize('US/Eastern')
320   dr
321   dr.round('s')
322
323Timedeltas
324
325.. ipython:: python
326
327   t = pd.timedelta_range('1 days 2 hr 13 min 45 us', periods=3, freq='d')
328   t
329   t.round('10min')
330
331   # Timedelta scalar
332   t[0]
333   t[0].round('2h')
334
335
336In addition, ``.round()``, ``.floor()`` and ``.ceil()`` will be available through the ``.dt`` accessor of ``Series``.
337
338.. ipython:: python
339
340   s = pd.Series(dr)
341   s
342   s.dt.round('D')
343
344Formatting of integers in FloatIndex
345^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
346
347Integers in ``FloatIndex``, e.g. 1., are now formatted with a decimal point and a ``0`` digit, e.g. ``1.0`` (:issue:`11713`)
348This change not only affects the display to the console, but also the output of IO methods like ``.to_csv`` or ``.to_html``.
349
350Previous behavior:
351
352.. code-block:: ipython
353
354   In [2]: s = pd.Series([1, 2, 3], index=np.arange(3.))
355
356   In [3]: s
357   Out[3]:
358   0    1
359   1    2
360   2    3
361   dtype: int64
362
363   In [4]: s.index
364   Out[4]: Float64Index([0.0, 1.0, 2.0], dtype='float64')
365
366   In [5]: print(s.to_csv(path=None))
367   0,1
368   1,2
369   2,3
370
371
372New behavior:
373
374.. ipython:: python
375
376   s = pd.Series([1, 2, 3], index=np.arange(3.))
377   s
378   s.index
379   print(s.to_csv(path_or_buf=None, header=False))
380
381Changes to dtype assignment behaviors
382^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
383
384When a DataFrame's slice is updated with a new slice of the same dtype, the dtype of the DataFrame will now remain the same. (:issue:`10503`)
385
386Previous behavior:
387
388.. code-block:: ipython
389
390   In [5]: df = pd.DataFrame({'a': [0, 1, 1],
391                              'b': pd.Series([100, 200, 300], dtype='uint32')})
392
393   In [7]: df.dtypes
394   Out[7]:
395   a     int64
396   b    uint32
397   dtype: object
398
399   In [8]: ix = df['a'] == 1
400
401   In [9]: df.loc[ix, 'b'] = df.loc[ix, 'b']
402
403   In [11]: df.dtypes
404   Out[11]:
405   a    int64
406   b    int64
407   dtype: object
408
409New behavior:
410
411.. ipython:: python
412
413   df = pd.DataFrame({'a': [0, 1, 1],
414                      'b': pd.Series([100, 200, 300], dtype='uint32')})
415   df.dtypes
416   ix = df['a'] == 1
417   df.loc[ix, 'b'] = df.loc[ix, 'b']
418   df.dtypes
419
420When a DataFrame's integer slice is partially updated with a new slice of floats that could potentially be down-casted to integer without losing precision, the dtype of the slice will be set to float instead of integer.
421
422Previous behavior:
423
424.. code-block:: ipython
425
426   In [4]: df = pd.DataFrame(np.array(range(1,10)).reshape(3,3),
427                             columns=list('abc'),
428                             index=[[4,4,8], [8,10,12]])
429
430   In [5]: df
431   Out[5]:
432         a  b  c
433   4 8   1  2  3
434     10  4  5  6
435   8 12  7  8  9
436
437   In [7]: df.ix[4, 'c'] = np.array([0., 1.])
438
439   In [8]: df
440   Out[8]:
441         a  b  c
442   4 8   1  2  0
443     10  4  5  1
444   8 12  7  8  9
445
446New behavior:
447
448.. ipython:: python
449
450   df = pd.DataFrame(np.array(range(1,10)).reshape(3,3),
451                     columns=list('abc'),
452                     index=[[4,4,8], [8,10,12]])
453   df
454   df.loc[4, 'c'] = np.array([0., 1.])
455   df
456
457.. _whatsnew_0180.enhancements.xarray:
458
459Method to_xarray
460^^^^^^^^^^^^^^^^
461
462In a future version of pandas, we will be deprecating ``Panel`` and other > 2 ndim objects. In order to provide for continuity,
463all ``NDFrame`` objects have gained the ``.to_xarray()`` method in order to convert to ``xarray`` objects, which has
464a pandas-like interface for > 2 ndim. (:issue:`11972`)
465
466See the `xarray full-documentation here <http://xarray.pydata.org/en/stable/>`__.
467
468.. code-block:: ipython
469
470   In [1]: p = Panel(np.arange(2*3*4).reshape(2,3,4))
471
472   In [2]: p.to_xarray()
473   Out[2]:
474   <xarray.DataArray (items: 2, major_axis: 3, minor_axis: 4)>
475   array([[[ 0,  1,  2,  3],
476           [ 4,  5,  6,  7],
477           [ 8,  9, 10, 11]],
478
479          [[12, 13, 14, 15],
480           [16, 17, 18, 19],
481           [20, 21, 22, 23]]])
482   Coordinates:
483     * items       (items) int64 0 1
484     * major_axis  (major_axis) int64 0 1 2
485     * minor_axis  (minor_axis) int64 0 1 2 3
486
487Latex representation
488^^^^^^^^^^^^^^^^^^^^
489
490``DataFrame`` has gained a ``._repr_latex_()`` method in order to allow for conversion to latex in a ipython/jupyter notebook using nbconvert. (:issue:`11778`)
491
492Note that this must be activated by setting the option ``pd.display.latex.repr=True`` (:issue:`12182`)
493
494For example, if you have a jupyter notebook you plan to convert to latex using nbconvert, place the statement ``pd.display.latex.repr=True`` in the first cell to have the contained DataFrame output also stored as latex.
495
496The options ``display.latex.escape`` and ``display.latex.longtable`` have also been added to the configuration and are used automatically by the ``to_latex``
497method. See the :ref:`available options docs <options.available>` for more info.
498
499.. _whatsnew_0180.enhancements.sas:
500
501``pd.read_sas()`` changes
502^^^^^^^^^^^^^^^^^^^^^^^^^
503
504``read_sas`` has gained the ability to read SAS7BDAT files, including compressed files.  The files can be read in entirety, or incrementally.  For full details see :ref:`here <io.sas>`. (:issue:`4052`)
505
506.. _whatsnew_0180.enhancements.other:
507
508Other enhancements
509^^^^^^^^^^^^^^^^^^
510
511- Handle truncated floats in SAS xport files (:issue:`11713`)
512- Added option to hide index in ``Series.to_string`` (:issue:`11729`)
513- ``read_excel`` now supports s3 urls of the format ``s3://bucketname/filename`` (:issue:`11447`)
514- add support for ``AWS_S3_HOST`` env variable when reading from s3 (:issue:`12198`)
515- A simple version of ``Panel.round()`` is now implemented (:issue:`11763`)
516- For Python 3.x, ``round(DataFrame)``, ``round(Series)``, ``round(Panel)`` will work (:issue:`11763`)
517- ``sys.getsizeof(obj)`` returns the memory usage of a pandas object, including the
518  values it contains (:issue:`11597`)
519- ``Series`` gained an ``is_unique`` attribute (:issue:`11946`)
520- ``DataFrame.quantile`` and ``Series.quantile`` now accept ``interpolation`` keyword (:issue:`10174`).
521- Added ``DataFrame.style.format`` for more flexible formatting of cell values (:issue:`11692`)
522- ``DataFrame.select_dtypes`` now allows the ``np.float16`` type code (:issue:`11990`)
523- ``pivot_table()`` now accepts most iterables for the ``values`` parameter (:issue:`12017`)
524- Added Google ``BigQuery`` service account authentication support, which enables authentication on remote servers. (:issue:`11881`, :issue:`12572`). For further details see `here <https://pandas-gbq.readthedocs.io/en/latest/intro.html>`__
525- ``HDFStore`` is now iterable: ``for k in store`` is equivalent to ``for k in store.keys()`` (:issue:`12221`).
526- Add missing methods/fields to ``.dt`` for ``Period`` (:issue:`8848`)
527- The entire code base has been ``PEP``-ified (:issue:`12096`)
528
529.. _whatsnew_0180.api_breaking:
530
531Backwards incompatible API changes
532~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533
534- the leading white spaces have been removed from the output of ``.to_string(index=False)`` method (:issue:`11833`)
535- the ``out`` parameter has been removed from the ``Series.round()`` method. (:issue:`11763`)
536- ``DataFrame.round()`` leaves non-numeric columns unchanged in its return, rather than raises. (:issue:`11885`)
537- ``DataFrame.head(0)`` and ``DataFrame.tail(0)`` return empty frames, rather than ``self``.  (:issue:`11937`)
538- ``Series.head(0)`` and ``Series.tail(0)`` return empty series, rather than ``self``.  (:issue:`11937`)
539- ``to_msgpack`` and ``read_msgpack`` encoding now defaults to ``'utf-8'``. (:issue:`12170`)
540- the order of keyword arguments to text file parsing functions (``.read_csv()``, ``.read_table()``, ``.read_fwf()``) changed to group related arguments. (:issue:`11555`)
541- ``NaTType.isoformat`` now returns the string ``'NaT`` to allow the result to
542  be passed to the constructor of ``Timestamp``. (:issue:`12300`)
543
544NaT and Timedelta operations
545^^^^^^^^^^^^^^^^^^^^^^^^^^^^
546
547``NaT`` and ``Timedelta`` have expanded arithmetic operations, which are extended to ``Series``
548arithmetic where applicable.  Operations defined for ``datetime64[ns]`` or ``timedelta64[ns]``
549are now also defined for ``NaT`` (:issue:`11564`).
550
551``NaT`` now supports arithmetic operations with integers and floats.
552
553.. ipython:: python
554
555   pd.NaT * 1
556   pd.NaT * 1.5
557   pd.NaT / 2
558   pd.NaT * np.nan
559
560``NaT`` defines more arithmetic operations with ``datetime64[ns]`` and ``timedelta64[ns]``.
561
562.. ipython:: python
563
564   pd.NaT / pd.NaT
565   pd.Timedelta('1s') / pd.NaT
566
567``NaT`` may represent either a ``datetime64[ns]`` null or a ``timedelta64[ns]`` null.
568Given the ambiguity, it is treated as a ``timedelta64[ns]``, which allows more operations
569to succeed.
570
571.. ipython:: python
572
573   pd.NaT + pd.NaT
574
575   # same as
576   pd.Timedelta('1s') + pd.Timedelta('1s')
577
578as opposed to
579
580.. code-block:: ipython
581
582   In [3]: pd.Timestamp('19900315') + pd.Timestamp('19900315')
583   TypeError: unsupported operand type(s) for +: 'Timestamp' and 'Timestamp'
584
585However, when wrapped in a ``Series`` whose ``dtype`` is ``datetime64[ns]`` or ``timedelta64[ns]``,
586the ``dtype`` information is respected.
587
588.. code-block:: ipython
589
590   In [1]: pd.Series([pd.NaT], dtype='<M8[ns]') + pd.Series([pd.NaT], dtype='<M8[ns]')
591   TypeError: can only operate on a datetimes for subtraction,
592              but the operator [__add__] was passed
593
594.. ipython:: python
595
596   pd.Series([pd.NaT], dtype='<m8[ns]') + pd.Series([pd.NaT], dtype='<m8[ns]')
597
598``Timedelta`` division by ``floats`` now works.
599
600.. ipython:: python
601
602   pd.Timedelta('1s') / 2.0
603
604Subtraction by ``Timedelta`` in a ``Series`` by a ``Timestamp`` works (:issue:`11925`)
605
606.. ipython:: python
607
608   ser = pd.Series(pd.timedelta_range('1 day', periods=3))
609   ser
610   pd.Timestamp('2012-01-01') - ser
611
612
613``NaT.isoformat()`` now returns ``'NaT'``. This change allows
614``pd.Timestamp`` to rehydrate any timestamp like object from its isoformat
615(:issue:`12300`).
616
617Changes to msgpack
618^^^^^^^^^^^^^^^^^^
619
620Forward incompatible changes in ``msgpack`` writing format were made over 0.17.0 and 0.18.0; older versions of pandas cannot read files packed by newer versions (:issue:`12129`, :issue:`10527`)
621
622Bugs in ``to_msgpack`` and ``read_msgpack`` introduced in 0.17.0 and fixed in 0.18.0, caused files packed in Python 2 unreadable by Python 3 (:issue:`12142`). The following table describes the backward and forward compat of msgpacks.
623
624.. warning::
625
626   +----------------------+------------------------+
627   | Packed with          | Can be unpacked with   |
628   +======================+========================+
629   | pre-0.17 / Python 2  | any                    |
630   +----------------------+------------------------+
631   | pre-0.17 / Python 3  | any                    |
632   +----------------------+------------------------+
633   | 0.17 / Python 2      | - ==0.17 / Python 2    |
634   |                      | - >=0.18 / any Python  |
635   +----------------------+------------------------+
636   | 0.17 / Python 3      | >=0.18 / any Python    |
637   +----------------------+------------------------+
638   | 0.18                 | >= 0.18                |
639   +----------------------+------------------------+
640
641
642   0.18.0 is backward-compatible for reading files packed by older versions, except for files packed with 0.17 in Python 2, in which case only they can only be unpacked in Python 2.
643
644Signature change for .rank
645^^^^^^^^^^^^^^^^^^^^^^^^^^
646
647``Series.rank`` and ``DataFrame.rank`` now have the same signature (:issue:`11759`)
648
649Previous signature
650
651.. code-block:: ipython
652
653   In [3]: pd.Series([0,1]).rank(method='average', na_option='keep',
654                                 ascending=True, pct=False)
655   Out[3]:
656   0    1
657   1    2
658   dtype: float64
659
660   In [4]: pd.DataFrame([0,1]).rank(axis=0, numeric_only=None,
661                                    method='average', na_option='keep',
662                                    ascending=True, pct=False)
663   Out[4]:
664      0
665   0  1
666   1  2
667
668New signature
669
670.. ipython:: python
671
672   pd.Series([0,1]).rank(axis=0, method='average', numeric_only=None,
673                         na_option='keep', ascending=True, pct=False)
674   pd.DataFrame([0,1]).rank(axis=0, method='average', numeric_only=None,
675                            na_option='keep', ascending=True, pct=False)
676
677
678Bug in QuarterBegin with n=0
679^^^^^^^^^^^^^^^^^^^^^^^^^^^^
680
681In previous versions, the behavior of the QuarterBegin offset was inconsistent
682depending on the date when the ``n`` parameter was 0. (:issue:`11406`)
683
684The general semantics of anchored offsets for ``n=0`` is to not move the date
685when it is an anchor point (e.g., a quarter start date), and otherwise roll
686forward to the next anchor point.
687
688.. ipython:: python
689
690   d = pd.Timestamp('2014-02-01')
691   d
692   d + pd.offsets.QuarterBegin(n=0, startingMonth=2)
693   d + pd.offsets.QuarterBegin(n=0, startingMonth=1)
694
695For the ``QuarterBegin`` offset in previous versions, the date would be rolled
696*backwards* if date was in the same month as the quarter start date.
697
698.. code-block:: ipython
699
700   In [3]: d = pd.Timestamp('2014-02-15')
701
702   In [4]: d + pd.offsets.QuarterBegin(n=0, startingMonth=2)
703   Out[4]: Timestamp('2014-02-01 00:00:00')
704
705This behavior has been corrected in version 0.18.0, which is consistent with
706other anchored offsets like ``MonthBegin`` and ``YearBegin``.
707
708.. ipython:: python
709
710   d = pd.Timestamp('2014-02-15')
711   d + pd.offsets.QuarterBegin(n=0, startingMonth=2)
712
713.. _whatsnew_0180.breaking.resample:
714
715Resample API
716^^^^^^^^^^^^
717
718Like the change in the window functions API :ref:`above <whatsnew_0180.enhancements.moments>`, ``.resample(...)`` is changing to have a more groupby-like API. (:issue:`11732`, :issue:`12702`, :issue:`12202`, :issue:`12332`, :issue:`12334`, :issue:`12348`, :issue:`12448`).
719
720.. ipython:: python
721
722   np.random.seed(1234)
723   df = pd.DataFrame(np.random.rand(10,4),
724                     columns=list('ABCD'),
725                     index=pd.date_range('2010-01-01 09:00:00',
726                                         periods=10, freq='s'))
727   df
728
729
730**Previous API**:
731
732You would write a resampling operation that immediately evaluates. If a ``how`` parameter was not provided, it
733would default to ``how='mean'``.
734
735.. code-block:: ipython
736
737   In [6]: df.resample('2s')
738   Out[6]:
739                            A         B         C         D
740   2010-01-01 09:00:00  0.485748  0.447351  0.357096  0.793615
741   2010-01-01 09:00:02  0.820801  0.794317  0.364034  0.531096
742   2010-01-01 09:00:04  0.433985  0.314582  0.424104  0.625733
743   2010-01-01 09:00:06  0.624988  0.609738  0.633165  0.612452
744   2010-01-01 09:00:08  0.510470  0.534317  0.573201  0.806949
745
746You could also specify a ``how`` directly
747
748.. code-block:: ipython
749
750   In [7]: df.resample('2s', how='sum')
751   Out[7]:
752                            A         B         C         D
753   2010-01-01 09:00:00  0.971495  0.894701  0.714192  1.587231
754   2010-01-01 09:00:02  1.641602  1.588635  0.728068  1.062191
755   2010-01-01 09:00:04  0.867969  0.629165  0.848208  1.251465
756   2010-01-01 09:00:06  1.249976  1.219477  1.266330  1.224904
757   2010-01-01 09:00:08  1.020940  1.068634  1.146402  1.613897
758
759**New API**:
760
761Now, you can write ``.resample(..)`` as a 2-stage operation like ``.groupby(...)``, which
762yields a ``Resampler``.
763
764.. ipython:: python
765   :okwarning:
766
767   r = df.resample('2s')
768   r
769
770Downsampling
771""""""""""""
772
773You can then use this object to perform operations.
774These are downsampling operations (going from a higher frequency to a lower one).
775
776.. ipython:: python
777
778   r.mean()
779
780.. ipython:: python
781
782   r.sum()
783
784Furthermore, resample now supports ``getitem`` operations to perform the resample on specific columns.
785
786.. ipython:: python
787
788   r[['A','C']].mean()
789
790and ``.aggregate`` type operations.
791
792.. ipython:: python
793
794   r.agg({'A' : 'mean', 'B' : 'sum'})
795
796These accessors can of course, be combined
797
798.. ipython:: python
799
800   r[['A','B']].agg(['mean','sum'])
801
802Upsampling
803""""""""""
804
805.. currentmodule:: pandas.tseries.resample
806
807Upsampling operations take you from a lower frequency to a higher frequency. These are now
808performed with the ``Resampler`` objects with :meth:`~Resampler.backfill`,
809:meth:`~Resampler.ffill`, :meth:`~Resampler.fillna` and :meth:`~Resampler.asfreq` methods.
810
811.. ipython:: python
812
813   s = pd.Series(np.arange(5, dtype='int64'),
814                 index=pd.date_range('2010-01-01', periods=5, freq='Q'))
815   s
816
817Previously
818
819.. code-block:: ipython
820
821   In [6]: s.resample('M', fill_method='ffill')
822   Out[6]:
823   2010-03-31    0
824   2010-04-30    0
825   2010-05-31    0
826   2010-06-30    1
827   2010-07-31    1
828   2010-08-31    1
829   2010-09-30    2
830   2010-10-31    2
831   2010-11-30    2
832   2010-12-31    3
833   2011-01-31    3
834   2011-02-28    3
835   2011-03-31    4
836   Freq: M, dtype: int64
837
838New API
839
840.. ipython:: python
841
842   s.resample('M').ffill()
843
844.. note::
845
846   In the new API, you can either downsample OR upsample. The prior implementation would allow you to pass an aggregator function (like ``mean``) even though you were upsampling, providing a bit of confusion.
847
848Previous API will work but with deprecations
849""""""""""""""""""""""""""""""""""""""""""""
850
851.. warning::
852
853   This new API for resample includes some internal changes for the prior-to-0.18.0 API, to work with a deprecation warning in most cases, as the resample operation returns a deferred object. We can intercept operations and just do what the (pre 0.18.0) API did (with a warning). Here is a typical use case:
854
855   .. code-block:: ipython
856
857      In [4]: r = df.resample('2s')
858
859      In [6]: r*10
860      pandas/tseries/resample.py:80: FutureWarning: .resample() is now a deferred operation
861      use .resample(...).mean() instead of .resample(...)
862
863      Out[6]:
864                            A         B         C         D
865      2010-01-01 09:00:00  4.857476  4.473507  3.570960  7.936154
866      2010-01-01 09:00:02  8.208011  7.943173  3.640340  5.310957
867      2010-01-01 09:00:04  4.339846  3.145823  4.241039  6.257326
868      2010-01-01 09:00:06  6.249881  6.097384  6.331650  6.124518
869      2010-01-01 09:00:08  5.104699  5.343172  5.732009  8.069486
870
871   However, getting and assignment operations directly on a ``Resampler`` will raise a ``ValueError``:
872
873   .. code-block:: ipython
874
875      In [7]: r.iloc[0] = 5
876      ValueError: .resample() is now a deferred operation
877      use .resample(...).mean() instead of .resample(...)
878
879   There is a situation where the new API can not perform all the operations when using original code.
880   This code is intending to resample every 2s, take the ``mean`` AND then take the ``min`` of those results.
881
882   .. code-block:: ipython
883
884      In [4]: df.resample('2s').min()
885      Out[4]:
886      A    0.433985
887      B    0.314582
888      C    0.357096
889      D    0.531096
890      dtype: float64
891
892   The new API will:
893
894   .. ipython:: python
895
896      df.resample('2s').min()
897
898   The good news is the return dimensions will differ between the new API and the old API, so this should loudly raise
899   an exception.
900
901   To replicate the original operation
902
903   .. ipython:: python
904
905      df.resample('2s').mean().min()
906
907Changes to eval
908^^^^^^^^^^^^^^^
909
910In prior versions, new columns assignments in an ``eval`` expression resulted
911in an inplace change to the ``DataFrame``. (:issue:`9297`, :issue:`8664`, :issue:`10486`)
912
913.. ipython:: python
914
915   df = pd.DataFrame({'a': np.linspace(0, 10, 5), 'b': range(5)})
916   df
917
918.. ipython:: python
919   :suppress:
920
921   df.eval('c = a + b', inplace=True)
922
923.. code-block:: ipython
924
925   In [12]: df.eval('c = a + b')
926   FutureWarning: eval expressions containing an assignment currentlydefault to operating inplace.
927   This will change in a future version of pandas, use inplace=True to avoid this warning.
928
929   In [13]: df
930   Out[13]:
931         a  b     c
932   0   0.0  0   0.0
933   1   2.5  1   3.5
934   2   5.0  2   7.0
935   3   7.5  3  10.5
936   4  10.0  4  14.0
937
938In version 0.18.0, a new ``inplace`` keyword was added to choose whether the
939assignment should be done inplace or return a copy.
940
941.. ipython:: python
942
943   df
944   df.eval('d = c - b', inplace=False)
945   df
946   df.eval('d = c - b', inplace=True)
947   df
948
949.. warning::
950
951   For backwards compatibility, ``inplace`` defaults to ``True`` if not specified.
952   This will change in a future version of pandas. If your code depends on an
953   inplace assignment you should update to explicitly set ``inplace=True``
954
955The ``inplace`` keyword parameter was also added the ``query`` method.
956
957.. ipython:: python
958
959   df.query('a > 5')
960   df.query('a > 5', inplace=True)
961   df
962
963.. warning::
964
965   Note that the default value for ``inplace`` in a ``query``
966   is ``False``, which is consistent with prior versions.
967
968``eval`` has also been updated to allow multi-line expressions for multiple
969assignments.  These expressions will be evaluated one at a time in order.  Only
970assignments are valid for multi-line expressions.
971
972.. ipython:: python
973
974   df
975   df.eval("""
976   e = d + a
977   f = e - 22
978   g = f / 2.0""", inplace=True)
979   df
980
981
982.. _whatsnew_0180.api:
983
984Other API changes
985^^^^^^^^^^^^^^^^^
986- ``DataFrame.between_time`` and ``Series.between_time`` now only parse a fixed set of time strings. Parsing of date strings is no longer supported and raises a ``ValueError``. (:issue:`11818`)
987
988  .. ipython:: python
989
990     s = pd.Series(range(10), pd.date_range('2015-01-01', freq='H', periods=10))
991     s.between_time("7:00am", "9:00am")
992
993  This will now raise.
994
995  .. code-block:: ipython
996
997     In [2]: s.between_time('20150101 07:00:00','20150101 09:00:00')
998     ValueError: Cannot convert arg ['20150101 07:00:00'] to a time.
999
1000- ``.memory_usage()`` now includes values in the index, as does memory_usage in ``.info()`` (:issue:`11597`)
1001- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg ``utf-8``) in Python 2 with the parameter ``encoding`` (:issue:`7061`)
1002- ``pandas.merge()`` and ``DataFrame.merge()`` will show a specific error message when trying to merge with an object that is not of type ``DataFrame`` or a subclass (:issue:`12081`)
1003- ``DataFrame.unstack`` and ``Series.unstack`` now take ``fill_value`` keyword to allow direct replacement of missing values when an unstack results in missing values in the resulting ``DataFrame``. As an added benefit, specifying ``fill_value`` will preserve the data type of the original stacked data.  (:issue:`9746`)
1004- As part of the new API for :ref:`window functions <whatsnew_0180.enhancements.moments>` and :ref:`resampling <whatsnew_0180.breaking.resample>`, aggregation functions have been clarified, raising more informative error messages on invalid aggregations. (:issue:`9052`). A full set of examples are presented in :ref:`groupby <groupby.aggregate>`.
1005- Statistical functions for ``NDFrame`` objects (like ``sum(), mean(), min()``) will now raise if non-numpy-compatible arguments are passed in for ``**kwargs`` (:issue:`12301`)
1006- ``.to_latex`` and ``.to_html`` gain a ``decimal`` parameter like ``.to_csv``; the default is ``'.'`` (:issue:`12031`)
1007- More helpful error message when constructing a ``DataFrame`` with empty data but with indices (:issue:`8020`)
1008- ``.describe()`` will now properly handle bool dtype as a categorical (:issue:`6625`)
1009- More helpful error message with an invalid ``.transform`` with user defined input (:issue:`10165`)
1010- Exponentially weighted functions now allow specifying alpha directly (:issue:`10789`) and raise ``ValueError`` if parameters violate ``0 < alpha <= 1`` (:issue:`12492`)
1011
1012.. _whatsnew_0180.deprecations:
1013
1014Deprecations
1015^^^^^^^^^^^^
1016
1017.. _whatsnew_0180.window_deprecations:
1018
1019- The functions ``pd.rolling_*``, ``pd.expanding_*``, and ``pd.ewm*`` are deprecated and replaced by the corresponding method call. Note that
1020  the new suggested syntax includes all of the arguments (even if default) (:issue:`11603`)
1021
1022  .. code-block:: ipython
1023
1024     In [1]: s = pd.Series(range(3))
1025
1026     In [2]: pd.rolling_mean(s,window=2,min_periods=1)
1027             FutureWarning: pd.rolling_mean is deprecated for Series and
1028                  will be removed in a future version, replace with
1029                  Series.rolling(min_periods=1,window=2,center=False).mean()
1030     Out[2]:
1031             0    0.0
1032             1    0.5
1033             2    1.5
1034             dtype: float64
1035
1036     In [3]: pd.rolling_cov(s, s, window=2)
1037             FutureWarning: pd.rolling_cov is deprecated for Series and
1038                  will be removed in a future version, replace with
1039                  Series.rolling(window=2).cov(other=<Series>)
1040     Out[3]:
1041             0    NaN
1042             1    0.5
1043             2    0.5
1044             dtype: float64
1045
1046- The ``freq`` and ``how`` arguments to the ``.rolling``, ``.expanding``, and ``.ewm`` (new) functions are deprecated, and will be removed in a future version. You can simply resample the input prior to creating a window function. (:issue:`11603`).
1047
1048  For example, instead of ``s.rolling(window=5,freq='D').max()`` to get the max value on a rolling 5 Day window, one could use ``s.resample('D').mean().rolling(window=5).max()``, which first resamples the data to daily data, then provides a rolling 5 day window.
1049
1050- ``pd.tseries.frequencies.get_offset_name`` function is deprecated. Use offset's ``.freqstr`` property as alternative (:issue:`11192`)
1051- ``pandas.stats.fama_macbeth`` routines are deprecated and will be removed in a future version (:issue:`6077`)
1052- ``pandas.stats.ols``, ``pandas.stats.plm`` and ``pandas.stats.var`` routines are deprecated and will be removed in a future version (:issue:`6077`)
1053- show a ``FutureWarning`` rather than a ``DeprecationWarning`` on using long-time deprecated syntax in ``HDFStore.select``, where the ``where`` clause is not a string-like (:issue:`12027`)
1054
1055- The ``pandas.options.display.mpl_style`` configuration has been deprecated
1056  and will be removed in a future version of pandas. This functionality
1057  is better handled by matplotlib's `style sheets`_ (:issue:`11783`).
1058
1059
1060.. _style sheets: http://matplotlib.org/users/style_sheets.html
1061
1062.. _whatsnew_0180.float_indexers:
1063
1064Removal of deprecated float indexers
1065^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1066
1067In :issue:`4892` indexing with floating point numbers on a non-``Float64Index`` was deprecated (in version 0.14.0).
1068In 0.18.0, this deprecation warning is removed and these will now raise a ``TypeError``. (:issue:`12165`, :issue:`12333`)
1069
1070.. ipython:: python
1071
1072   s = pd.Series([1, 2, 3], index=[4, 5, 6])
1073   s
1074   s2 = pd.Series([1, 2, 3], index=list('abc'))
1075   s2
1076
1077Previous behavior:
1078
1079.. code-block:: ipython
1080
1081   # this is label indexing
1082   In [2]: s[5.0]
1083   FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
1084   Out[2]: 2
1085
1086   # this is positional indexing
1087   In [3]: s.iloc[1.0]
1088   FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
1089   Out[3]: 2
1090
1091   # this is label indexing
1092   In [4]: s.loc[5.0]
1093   FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
1094   Out[4]: 2
1095
1096   # .ix would coerce 1.0 to the positional 1, and index
1097   In [5]: s2.ix[1.0] = 10
1098   FutureWarning: scalar indexers for index type Index should be integers and not floating point
1099
1100   In [6]: s2
1101   Out[6]:
1102   a     1
1103   b    10
1104   c     3
1105   dtype: int64
1106
1107New behavior:
1108
1109For iloc, getting & setting via a float scalar will always raise.
1110
1111.. code-block:: ipython
1112
1113   In [3]: s.iloc[2.0]
1114   TypeError: cannot do label indexing on <class 'pandas.indexes.numeric.Int64Index'> with these indexers [2.0] of <type 'float'>
1115
1116Other indexers will coerce to a like integer for both getting and setting. The ``FutureWarning`` has been dropped for ``.loc``, ``.ix`` and ``[]``.
1117
1118.. ipython:: python
1119
1120   s[5.0]
1121   s.loc[5.0]
1122
1123and setting
1124
1125.. ipython:: python
1126
1127   s_copy = s.copy()
1128   s_copy[5.0] = 10
1129   s_copy
1130   s_copy = s.copy()
1131   s_copy.loc[5.0] = 10
1132   s_copy
1133
1134Positional setting with ``.ix`` and a float indexer will ADD this value to the index, rather than previously setting the value by position.
1135
1136.. code-block:: ipython
1137
1138   In [3]: s2.ix[1.0] = 10
1139   In [4]: s2
1140   Out[4]:
1141   a       1
1142   b       2
1143   c       3
1144   1.0    10
1145   dtype: int64
1146
1147Slicing will also coerce integer-like floats to integers for a non-``Float64Index``.
1148
1149.. ipython:: python
1150
1151   s.loc[5.0:6]
1152
1153Note that for floats that are NOT coercible to ints, the label based bounds will be excluded
1154
1155.. ipython:: python
1156
1157   s.loc[5.1:6]
1158
1159Float indexing on a ``Float64Index`` is unchanged.
1160
1161.. ipython:: python
1162
1163   s = pd.Series([1, 2, 3], index=np.arange(3.))
1164   s[1.0]
1165   s[1.0:2.5]
1166
1167.. _whatsnew_0180.prior_deprecations:
1168
1169Removal of prior version deprecations/changes
1170^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1171
1172- Removal of ``rolling_corr_pairwise`` in favor of ``.rolling().corr(pairwise=True)`` (:issue:`4950`)
1173- Removal of ``expanding_corr_pairwise`` in favor of ``.expanding().corr(pairwise=True)`` (:issue:`4950`)
1174- Removal of ``DataMatrix`` module. This was not imported into the pandas namespace in any event (:issue:`12111`)
1175- Removal of ``cols`` keyword in favor of ``subset`` in ``DataFrame.duplicated()`` and ``DataFrame.drop_duplicates()`` (:issue:`6680`)
1176- Removal of the ``read_frame`` and ``frame_query`` (both aliases for ``pd.read_sql``)
1177  and ``write_frame`` (alias of ``to_sql``) functions in the ``pd.io.sql`` namespace,
1178  deprecated since 0.14.0 (:issue:`6292`).
1179- Removal of the ``order`` keyword from ``.factorize()`` (:issue:`6930`)
1180
1181.. _whatsnew_0180.performance:
1182
1183Performance improvements
1184~~~~~~~~~~~~~~~~~~~~~~~~
1185
1186- Improved performance of ``andrews_curves`` (:issue:`11534`)
1187- Improved huge ``DatetimeIndex``, ``PeriodIndex`` and ``TimedeltaIndex``'s ops performance including ``NaT`` (:issue:`10277`)
1188- Improved performance of ``pandas.concat`` (:issue:`11958`)
1189- Improved performance of ``StataReader`` (:issue:`11591`)
1190- Improved performance in construction of ``Categoricals`` with ``Series`` of datetimes containing ``NaT`` (:issue:`12077`)
1191
1192
1193- Improved performance of ISO 8601 date parsing for dates without separators (:issue:`11899`), leading zeros (:issue:`11871`) and with white space preceding the time zone (:issue:`9714`)
1194
1195
1196
1197
1198.. _whatsnew_0180.bug_fixes:
1199
1200Bug fixes
1201~~~~~~~~~
1202
1203- Bug in ``GroupBy.size`` when data-frame is empty. (:issue:`11699`)
1204- Bug in ``Period.end_time`` when a multiple of time period is requested (:issue:`11738`)
1205- Regression in ``.clip`` with tz-aware datetimes (:issue:`11838`)
1206- Bug in ``date_range`` when the boundaries fell on the frequency (:issue:`11804`, :issue:`12409`)
1207- Bug in consistency of passing nested dicts to ``.groupby(...).agg(...)`` (:issue:`9052`)
1208- Accept unicode in ``Timedelta`` constructor (:issue:`11995`)
1209- Bug in value label reading for ``StataReader`` when reading incrementally (:issue:`12014`)
1210- Bug in vectorized ``DateOffset`` when ``n`` parameter is ``0`` (:issue:`11370`)
1211- Compat for numpy 1.11 w.r.t. ``NaT`` comparison changes (:issue:`12049`)
1212- Bug in ``read_csv`` when reading from a ``StringIO`` in threads (:issue:`11790`)
1213- Bug in not treating ``NaT`` as a missing value in datetimelikes when factorizing & with ``Categoricals`` (:issue:`12077`)
1214- Bug in getitem when the values of a ``Series`` were tz-aware (:issue:`12089`)
1215- Bug in ``Series.str.get_dummies`` when one of the variables was 'name' (:issue:`12180`)
1216- Bug in ``pd.concat`` while concatenating tz-aware NaT series. (:issue:`11693`, :issue:`11755`, :issue:`12217`)
1217- Bug in ``pd.read_stata`` with version <= 108 files (:issue:`12232`)
1218- Bug in ``Series.resample`` using a frequency of ``Nano`` when the index is a ``DatetimeIndex`` and contains non-zero nanosecond parts (:issue:`12037`)
1219- Bug in resampling with ``.nunique`` and a sparse index (:issue:`12352`)
1220- Removed some compiler warnings (:issue:`12471`)
1221- Work around compat issues with ``boto`` in python 3.5 (:issue:`11915`)
1222- Bug in ``NaT`` subtraction from ``Timestamp`` or ``DatetimeIndex`` with timezones (:issue:`11718`)
1223- Bug in subtraction of ``Series`` of a single tz-aware ``Timestamp`` (:issue:`12290`)
1224- Use compat iterators in PY2 to support ``.next()`` (:issue:`12299`)
1225- Bug in ``Timedelta.round`` with negative values (:issue:`11690`)
1226- Bug in ``.loc`` against ``CategoricalIndex`` may result in normal ``Index`` (:issue:`11586`)
1227- Bug in ``DataFrame.info`` when duplicated column names exist (:issue:`11761`)
1228- Bug in ``.copy`` of datetime tz-aware objects (:issue:`11794`)
1229- Bug in ``Series.apply`` and ``Series.map`` where ``timedelta64`` was not boxed (:issue:`11349`)
1230- Bug in ``DataFrame.set_index()`` with tz-aware ``Series`` (:issue:`12358`)
1231
1232
1233
1234- Bug in subclasses of ``DataFrame`` where ``AttributeError`` did not propagate (:issue:`11808`)
1235- Bug groupby on tz-aware data where selection not returning ``Timestamp`` (:issue:`11616`)
1236- Bug in ``pd.read_clipboard`` and ``pd.to_clipboard`` functions not supporting Unicode; upgrade included ``pyperclip`` to v1.5.15 (:issue:`9263`)
1237- Bug in ``DataFrame.query`` containing an assignment (:issue:`8664`)
1238
1239- Bug in ``from_msgpack`` where ``__contains__()`` fails for columns of the unpacked ``DataFrame``, if the ``DataFrame`` has object columns. (:issue:`11880`)
1240- Bug in ``.resample`` on categorical data with ``TimedeltaIndex`` (:issue:`12169`)
1241
1242
1243- Bug in timezone info lost when broadcasting scalar datetime to ``DataFrame`` (:issue:`11682`)
1244- Bug in ``Index`` creation from ``Timestamp`` with mixed tz coerces to UTC (:issue:`11488`)
1245- Bug in ``to_numeric`` where it does not raise if input is more than one dimension (:issue:`11776`)
1246- Bug in parsing timezone offset strings with non-zero minutes (:issue:`11708`)
1247- Bug in ``df.plot`` using incorrect colors for bar plots under matplotlib 1.5+ (:issue:`11614`)
1248- Bug in the ``groupby`` ``plot`` method when using keyword arguments (:issue:`11805`).
1249- Bug in ``DataFrame.duplicated`` and ``drop_duplicates`` causing spurious matches when setting ``keep=False`` (:issue:`11864`)
1250- Bug in ``.loc`` result with duplicated key may have ``Index`` with incorrect dtype (:issue:`11497`)
1251- Bug in ``pd.rolling_median`` where memory allocation failed even with sufficient memory (:issue:`11696`)
1252- Bug in ``DataFrame.style`` with spurious zeros (:issue:`12134`)
1253- Bug in ``DataFrame.style`` with integer columns not starting at 0 (:issue:`12125`)
1254- Bug in ``.style.bar`` may not rendered properly using specific browser (:issue:`11678`)
1255- Bug in rich comparison of ``Timedelta`` with a ``numpy.array`` of ``Timedelta`` that caused an infinite recursion (:issue:`11835`)
1256- Bug in ``DataFrame.round`` dropping column index name (:issue:`11986`)
1257- Bug in ``df.replace`` while replacing value in mixed dtype ``Dataframe`` (:issue:`11698`)
1258- Bug in ``Index`` prevents copying name of passed ``Index``, when a new name is not provided (:issue:`11193`)
1259- Bug in ``read_excel`` failing to read any non-empty sheets when empty sheets exist and ``sheetname=None`` (:issue:`11711`)
1260- Bug in ``read_excel`` failing to raise ``NotImplemented`` error when keywords ``parse_dates`` and ``date_parser`` are provided (:issue:`11544`)
1261- Bug in ``read_sql`` with ``pymysql`` connections failing to return chunked data (:issue:`11522`)
1262- Bug in ``.to_csv`` ignoring formatting parameters ``decimal``, ``na_rep``, ``float_format`` for float indexes (:issue:`11553`)
1263- Bug in ``Int64Index`` and ``Float64Index`` preventing the use of the modulo operator (:issue:`9244`)
1264- Bug in ``MultiIndex.drop`` for not lexsorted MultiIndexes (:issue:`12078`)
1265
1266- Bug in ``DataFrame`` when masking an empty ``DataFrame`` (:issue:`11859`)
1267
1268
1269- Bug in ``.plot`` potentially modifying the ``colors`` input when the number of columns didn't match the number of series provided (:issue:`12039`).
1270- Bug in ``Series.plot`` failing when index has a ``CustomBusinessDay`` frequency (:issue:`7222`).
1271- Bug in ``.to_sql`` for ``datetime.time`` values with sqlite fallback (:issue:`8341`)
1272- Bug in ``read_excel`` failing to read data with one column when ``squeeze=True`` (:issue:`12157`)
1273- Bug in ``read_excel`` failing to read one empty column (:issue:`12292`, :issue:`9002`)
1274- Bug in ``.groupby`` where a ``KeyError`` was not raised for a wrong column if there was only one row in the dataframe (:issue:`11741`)
1275- Bug in ``.read_csv`` with dtype specified on empty data producing an error (:issue:`12048`)
1276- Bug in ``.read_csv`` where strings like ``'2E'`` are treated as valid floats (:issue:`12237`)
1277- Bug in building *pandas* with debugging symbols (:issue:`12123`)
1278
1279
1280- Removed ``millisecond`` property of ``DatetimeIndex``. This would always raise a ``ValueError`` (:issue:`12019`).
1281- Bug in ``Series`` constructor with read-only data (:issue:`11502`)
1282- Removed ``pandas._testing.choice()``.  Should use ``np.random.choice()``, instead. (:issue:`12386`)
1283- Bug in ``.loc`` setitem indexer preventing the use of a TZ-aware DatetimeIndex (:issue:`12050`)
1284- Bug in ``.style`` indexes and MultiIndexes not appearing (:issue:`11655`)
1285- Bug in ``to_msgpack`` and ``from_msgpack`` which did not correctly serialize or deserialize ``NaT`` (:issue:`12307`).
1286- Bug in ``.skew`` and ``.kurt`` due to roundoff error for highly similar values (:issue:`11974`)
1287- Bug in ``Timestamp`` constructor where microsecond resolution was lost if HHMMSS were not separated with ':' (:issue:`10041`)
1288- Bug in ``buffer_rd_bytes`` src->buffer could be freed more than once if reading failed, causing a segfault (:issue:`12098`)
1289
1290- Bug in ``crosstab`` where arguments with non-overlapping indexes would return a ``KeyError`` (:issue:`10291`)
1291
1292- Bug in ``DataFrame.apply`` in which reduction was not being prevented for cases in which ``dtype`` was not a numpy dtype (:issue:`12244`)
1293- Bug when initializing categorical series with a scalar value. (:issue:`12336`)
1294- Bug when specifying a UTC ``DatetimeIndex`` by setting ``utc=True`` in ``.to_datetime`` (:issue:`11934`)
1295- Bug when increasing the buffer size of CSV reader in ``read_csv`` (:issue:`12494`)
1296- Bug when setting columns of a ``DataFrame`` with duplicate column names (:issue:`12344`)
1297
1298
1299.. _whatsnew_0.18.0.contributors:
1300
1301Contributors
1302~~~~~~~~~~~~
1303
1304.. contributors:: v0.17.1..v0.18.0
1305