Skip to content

Commit a6cfc78

Browse files
committed
DOC: whatsnew and doc changes
1 parent d14dc1b commit a6cfc78

File tree

5 files changed

+70
-48
lines changed

5 files changed

+70
-48
lines changed

doc/source/computation.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ accept the following arguments:
254254

255255
The ``freq`` and ``how`` arguments were in the API prior to 0.18.0 changes. These are deprecated in the new API. You can simply resample the input prior to creating a window function.
256256

257-
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',how='max').rolling(window=5).max()``, which first resamples the data to daily data, then provides a rolling 5 day window.
257+
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').max().rolling(window=5).max()``, which first resamples the data to daily data, then provides a rolling 5 day window.
258258

259259
We can then call methods on these ``rolling`` objects. These return like-indexed objects:
260260

@@ -477,9 +477,7 @@ Aggregation
477477
-----------
478478

479479
Once the ``Rolling``, ``Expanding`` or ``EWM`` objects have been created, several methods are available to
480-
perform multiple computations on the data. This is very similar to a ``.groupby.agg`` seen :ref:`here <groupby.aggregate>`.
481-
482-
An obvious one is aggregation via the ``aggregate`` or equivalently ``agg`` method:
480+
perform multiple computations on the data. This is very similar to a ``.groupby(...).agg`` seen :ref:`here <groupby.aggregate>`.
483481

484482
.. ipython:: python
485483
@@ -545,7 +543,7 @@ columns of a DataFrame:
545543
'B' : lambda x: np.std(x, ddof=1)})
546544
547545
The function names can also be strings. In order for a string to be valid it
548-
must be implemented on the Windowed object
546+
must be implemented on the windowed object
549547

550548
.. ipython:: python
551549
@@ -647,7 +645,7 @@ Exponentially Weighted Windows
647645

648646
A related set of functions are exponentially weighted versions of several of
649647
the above statistics. A similar interface to ``.rolling`` and ``.expanding`` is accessed
650-
thru the ``.ewm`` method to receive a :class:`~pandas.core.window.EWM` object.
648+
thru the ``.ewm`` method to receive an :class:`~pandas.core.window.EWM` object.
651649
A number of expanding EW (exponentially weighted)
652650
methods are provided:
653651

@@ -806,5 +804,5 @@ are scaled by debiasing factors
806804
807805
(For :math:`w_i = 1`, this reduces to the usual :math:`N / (N - 1)` factor,
808806
with :math:`N = t + 1`.)
809-
See http://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance
807+
See `Weighted Sample Variance <http://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance>`__
810808
for further details.

doc/source/install.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ Optional Dependencies
253253
- `SQLite <https://docs.python.org/3.5/library/sqlite3.html>`__: for SQLite, this is included in Python's standard library by default.
254254

255255
* `matplotlib <http://matplotlib.sourceforge.net/>`__: for plotting
256-
* `statsmodels <http://statsmodels.sourceforge.net/>`__: Needed for parts of :mod:`pandas.stats`
257256
* `openpyxl <http://packages.python.org/openpyxl/>`__, `xlrd/xlwt <http://www.python-excel.org/>`__: Needed for Excel I/O
258257
* `XlsxWriter <https://pypi.python.org/pypi/XlsxWriter>`__: Alternative Excel writer
259258
* `Jinja2 <http://jinja.pocoo.org/>`__: Template engine for conditional HTML formatting.

doc/source/io.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4197,6 +4197,9 @@ The key functions are:
41974197

41984198
Authentication
41994199
''''''''''''''
4200+
4201+
.. versionadded:: 0.18.0
4202+
42004203
Authentication to the Google ``BigQuery`` service is via ``OAuth 2.0``.
42014204
Is possible to authenticate with either user account credentials or service account credentials.
42024205

@@ -4560,7 +4563,7 @@ SAS Formats
45604563
.. versionadded:: 0.17.0
45614564

45624565
The top-level function :func:`read_sas` can read (but not write) SAS
4563-
`xport` (.XPT) and `SAS7BDAT` (.sas7bdat) format files (v0.18.0).
4566+
`xport` (.XPT) and `SAS7BDAT` (.sas7bdat) format files were added in *v0.18.0*.
45644567

45654568
SAS files only contain two value types: ASCII text and floating point
45664569
values (usually 8 bytes but sometimes truncated). For xport files,

doc/source/options.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ Options are 'right', and 'left'.
267267
268268
269269
270-
List of Options
271-
---------------
270+
.. _options.available:
271+
272+
Available Options
273+
-----------------
272274

273275
========================== ============ ==================================
274276
Option Default Function

doc/source/whatsnew/v0.18.0.txt

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Window functions have been refactored to be methods on ``Series/DataFrame`` obje
5656
.. ipython:: python
5757

5858
np.random.seed(1234)
59-
df = DataFrame({'A' : range(10), 'B' : np.random.randn(10)})
59+
df = pd.DataFrame({'A' : range(10), 'B' : np.random.randn(10)})
6060
df
6161

6262
Previous Behavior:
@@ -153,7 +153,7 @@ Previous Behavior:
153153

154154
.. code-block:: python
155155

156-
In [3]: s = Series(range(1000))
156+
In [3]: s = pd.Series(range(1000))
157157

158158
In [4]: s.index
159159
Out[4]:
@@ -169,7 +169,7 @@ New Behavior:
169169

170170
.. ipython:: python
171171

172-
s = Series(range(1000))
172+
s = pd.Series(range(1000))
173173
s.index
174174
s.index.nbytes
175175

@@ -191,10 +191,17 @@ In v0.18.0, the ``expand`` argument was added to
191191

192192
Currently the default is ``expand=None`` which gives a ``FutureWarning`` and uses ``expand=False``. To avoid this warning, please explicitly specify ``expand``.
193193

194-
.. ipython:: python
195-
:okwarning:
194+
.. code-block:: python
196195

197-
pd.Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)', expand=None)
196+
In [1]: pd.Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)', expand=None)
197+
FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame)
198+
but in a future version of pandas this will be changed to expand=True (return DataFrame)
199+
200+
Out[1]:
201+
0 1
202+
1 2
203+
2 NaN
204+
dtype: object
198205

199206
Extracting a regular expression with one group returns a Series if
200207
``expand=False``.
@@ -215,7 +222,7 @@ returns an ``Index`` if ``expand=False``.
215222
.. ipython:: python
216223

217224
s = pd.Series(["a1", "b2", "c3"], ["A11", "B22", "C33"])
218-
s
225+
s.index
219226
s.index.str.extract("(?P<letter>[a-zA-Z])", expand=False)
220227

221228
It returns a ``DataFrame`` with one column if ``expand=True``.
@@ -248,16 +255,16 @@ Addition of str.extractall
248255
^^^^^^^^^^^^^^^^^^^^^^^^^^
249256

250257
The :ref:`.str.extractall <text.extractall>` method was added
251-
(:issue:`11386`). Unlike ``extract`` (which returns only the first
252-
match),
258+
(:issue:`11386`). Unlike ``extract``, which returns only the first
259+
match.
253260

254261
.. ipython:: python
255262

256263
s = pd.Series(["a1a2", "b1", "c1"], ["A", "B", "C"])
257264
s
258265
s.str.extract("(?P<letter>[ab])(?P<digit>\d)", expand=False)
259266

260-
the ``extractall`` method returns all matches.
267+
The ``extractall`` method returns all matches.
261268

262269
.. ipython:: python
263270

@@ -274,12 +281,12 @@ A new, friendlier ``ValueError`` is added to protect against the mistake of supp
274281

275282
.. ipython:: python
276283

277-
Series(['a','b',np.nan,'c']).str.cat(sep=' ')
278-
Series(['a','b',np.nan,'c']).str.cat(sep=' ', na_rep='?')
284+
pd.Series(['a','b',np.nan,'c']).str.cat(sep=' ')
285+
pd.Series(['a','b',np.nan,'c']).str.cat(sep=' ', na_rep='?')
279286

280287
.. code-block:: python
281288

282-
In [2]: Series(['a','b',np.nan,'c']).str.cat(' ')
289+
In [2]: pd.Series(['a','b',np.nan,'c']).str.cat(' ')
283290
ValueError: Did you mean to supply a `sep` keyword?
284291

285292

@@ -327,21 +334,21 @@ In addition, ``.round()``, ``.floor()`` and ``.ceil()`` will be available thru t
327334

328335
.. ipython:: python
329336

330-
s = Series(dr)
337+
s = pd.Series(dr)
331338
s
332339
s.dt.round('D')
333340

334-
Formatting of integer in FloatIndex
335-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
341+
Formatting of Integers in FloatIndex
342+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336343

337344
Integers in ``FloatIndex``, e.g. 1., are now formatted with a decimal point and a ``0`` digit, e.g. ``1.0`` (:issue:`11713`)
338-
This change not only affects the display in a jupyter notebook, but also the output of IO methods like ``.to_csv`` or ``.to_html``
345+
This change not only affects the display to the console, but also the output of IO methods like ``.to_csv`` or ``.to_html``.
339346

340347
Previous Behavior:
341348

342349
.. code-block:: python
343350

344-
In [2]: s = Series([1,2,3], index=np.arange(3.))
351+
In [2]: s = pd.Series([1,2,3], index=np.arange(3.))
345352

346353
In [3]: s
347354
Out[3]:
@@ -363,7 +370,7 @@ New Behavior:
363370

364371
.. ipython:: python
365372

366-
s = Series([1,2,3], index=np.arange(3.))
373+
s = pd.Series([1,2,3], index=np.arange(3.))
367374
s
368375
s.index
369376
print(s.to_csv(path=None))
@@ -451,7 +458,7 @@ to_xarray
451458

452459
In a future version of pandas, we will be deprecating ``Panel`` and other > 2 ndim objects. In order to provide for continuity,
453460
all ``NDFrame`` objects have gained the ``.to_xarray()`` method in order to convert to ``xarray`` objects, which has
454-
a pandas-like interface for > 2 ndim.
461+
a pandas-like interface for > 2 ndim. (:issue:`11972`)
455462

456463
See the `xarray full-documentation here <http://xarray.pydata.org/en/stable/>`__.
457464

@@ -479,17 +486,17 @@ Latex Representation
479486

480487
``DataFrame`` has gained a ``._repr_latex_()`` method in order to allow for conversion to latex in a ipython/jupyter notebook using nbconvert. (:issue:`11778`)
481488

482-
Note that this must be activated by setting the option ``display.latex.repr`` to ``True`` (issue:`12182`)
489+
Note that this must be activated by setting the option ``pd.display.latex.repr=True`` (:issue:`12182`)
483490

484-
For example, if you have a jupyter notebook you plan to convert to latex using nbconvert, place the statement ``pd.set_option('display.latex.repr', True)`` in the first cell to have the contained DataFrame output also stored as latex.
491+
For 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.
485492

486-
Options ``display.latex.escape`` and ``display.latex.longtable`` have also been added to the configuration and are used automatically by the ``to_latex``
487-
method. See the :ref:`options documentation<options>` for more info.
493+
The options ``display.latex.escape`` and ``display.latex.longtable`` have also been added to the configuration and are used automatically by the ``to_latex``
494+
method. See the :ref:`available options docs <options.available>` for more info.
488495

489496
.. _whatsnew_0180.enhancements.sas:
490497

491-
read_sas changes
492-
^^^^^^^^^^^^^^^^
498+
``pd.read_sas()`` changes
499+
^^^^^^^^^^^^^^^^^^^^^^^^^
493500

494501
``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`)
495502

@@ -736,7 +743,7 @@ You could also specify a ``how`` directly
736743

737744
.. code-block:: python
738745

739-
In [7]: df.resample('2s',how='sum')
746+
In [7]: df.resample('2s', how='sum')
740747
Out[7]:
741748
A B C D
742749
2010-01-01 09:00:00 0.971495 0.894701 0.714192 1.587231
@@ -747,7 +754,7 @@ You could also specify a ``how`` directly
747754

748755
**New API**:
749756

750-
Now, you can write ``.resample`` as a 2-stage operation like groupby, which
757+
Now, you can write ``.resample(..)`` as a 2-stage operation like ``.groupby(...)``, which
751758
yields a ``Resampler``.
752759

753760
.. ipython:: python
@@ -760,7 +767,7 @@ Downsampling
760767
''''''''''''
761768

762769
You can then use this object to perform operations.
763-
These are downsampling operations (going from a lower frequency to a higher one).
770+
These are downsampling operations (going from a higher frequency to a lower one).
764771

765772
.. ipython:: python
766773

@@ -793,7 +800,7 @@ Upsampling
793800

794801
.. currentmodule:: pandas.tseries.resample
795802

796-
Upsampling operations take you from a higher frequency to a lower frequency. These are now
803+
Upsampling operations take you from a lower frequency to a higher frequency. These are now
797804
performed with the ``Resampler`` objects with :meth:`~Resampler.backfill`,
798805
:meth:`~Resampler.ffill`, :meth:`~Resampler.fillna` and :meth:`~Resampler.asfreq` methods.
799806

@@ -834,8 +841,8 @@ New API
834841

835842
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.
836843

837-
Previous API will work but deprecations
838-
'''''''''''''''''''''''''''''''''''''''
844+
Previous API will work but with deprecations
845+
''''''''''''''''''''''''''''''''''''''''''''
839846

840847
.. warning::
841848

@@ -887,6 +894,12 @@ Previous API will work but deprecations
887894
The good news is the return dimensions will differ between the new API and the old API, so this should loudly raise
888895
an exception.
889896

897+
To replicate the original operation
898+
899+
.. ipython:: python
900+
901+
df.resample('2s').mean().min()
902+
890903
Changes to eval
891904
^^^^^^^^^^^^^^^
892905

@@ -980,16 +993,16 @@ Other API Changes
980993
In [2]: s.between_time('20150101 07:00:00','20150101 09:00:00')
981994
ValueError: Cannot convert arg ['20150101 07:00:00'] to a time.
982995

983-
- ``.memory_usage()`` now includes values in the index, as does memory_usage in ``.info`` (:issue:`11597`)
984-
- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg utf-8) in Python 2 with the parameter ``encoding`` (:issue:`7061`)
996+
- ``.memory_usage()`` now includes values in the index, as does memory_usage in ``.info()`` (:issue:`11597`)
997+
- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg ``utf-8``) in Python 2 with the parameter ``encoding`` (:issue:`7061`)
985998
- ``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`)
986999
- ``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`)
9871000
- 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>`.
988-
- Statistical functions for ``NDFrame`` objects will now raise if non-numpy-compatible arguments are passed in for ``**kwargs`` (:issue:`12301`)
1001+
- Statistical functions for ``NDFrame`` objects (like ``sum(), mean(), min()``) will now raise if non-numpy-compatible arguments are passed in for ``**kwargs`` (:issue:`12301`)
9891002
- ``.to_latex`` and ``.to_html`` gain a ``decimal`` parameter like ``.to_csv``; the default is ``'.'`` (:issue:`12031`)
9901003
- More helpful error message when constructing a ``DataFrame`` with empty data but with indices (:issue:`8020`)
9911004
- ``.describe()`` will now properly handle bool dtype as a categorical (:issue:`6625`)
992-
- More helpful error message invalid ``.transform`` with user defined input (:issue:`10165`)
1005+
- More helpful error message with an invalid ``.transform`` with user defined input (:issue:`10165`)
9931006
- Exponentially weighted functions now allow specifying alpha directly (:issue:`10789`) and raise ``ValueError`` if parameters violate ``0 < alpha <= 1`` (:issue:`12492`)
9941007

9951008
.. _whatsnew_0180.deprecations:
@@ -1028,7 +1041,7 @@ Deprecations
10281041

10291042
- The 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`).
10301043

1031-
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',how='max').rolling(window=5).max()``, which first resamples the data to daily data, then provides a rolling 5 day window.
1044+
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.
10321045

10331046
- ``pd.tseries.frequencies.get_offset_name`` function is deprecated. Use offset's ``.freqstr`` property as alternative (:issue:`11192`)
10341047
- ``pandas.stats.fama_macbeth`` routines are deprecated and will be removed in a future version (:issue:`6077`)
@@ -1118,6 +1131,13 @@ and setting
11181131
s_copy.ix[5.0] = 10
11191132
s_copy
11201133

1134+
Positional setting with ``.ix`` and a float indexer will ADD this value to the index, rather than previously setting the value by position.
1135+
1136+
.. ipython:: python
1137+
1138+
s2.ix[1.0] = 10
1139+
s2
1140+
11211141
Slicing will also coerce integer-like floats to integers for a non-``Float64Index``.
11221142

11231143
.. ipython:: python

0 commit comments

Comments
 (0)