Skip to content

Commit bd31b2b

Browse files
author
Carlos Souza
committed
Resolving merge conflict by incorporating @jreback suggestions
2 parents e62763c + 73805ce commit bd31b2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+727
-880
lines changed

.travis.yml

+23-28
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
sudo: false
22
language: python
3+
# Default Python version is usually 2.7
4+
python: 3.5
35

46
# To turn off cached cython files and compiler cache
57
# set NOCACHE-true
68
# To delete caches go to https://travis-ci.org/OWNER/REPOSITORY/caches or run
79
# travis cache --delete inside the project directory from the travis command line client
810
# The cash directories will be deleted if anything in ci/ changes in a commit
911
cache:
12+
ccache: true
1013
directories:
1114
- $HOME/.cache # cython cache
1215
- $HOME/.ccache # compiler cache
@@ -23,75 +26,67 @@ git:
2326

2427
matrix:
2528
fast_finish: true
29+
exclude:
30+
# Exclude the default Python 3.5 build
31+
- python: 3.5
2632
include:
27-
- language: objective-c
28-
os: osx
29-
compiler: clang
30-
cache:
31-
ccache: true
32-
directories:
33-
- $HOME/.cache # cython cache
34-
- $HOME/.ccache # compiler cache
33+
- os: osx
34+
language: generic
3535
env:
36-
- JOB="3.5_OSX" TEST_ARGS="--skip-slow --skip-network" TRAVIS_PYTHON_VERSION=3.5
37-
- python: 2.7
36+
- JOB="3.5_OSX" TEST_ARGS="--skip-slow --skip-network"
37+
- os: linux
3838
env:
3939
- JOB="2.7_LOCALE" TEST_ARGS="--only-slow --skip-network" LOCALE_OVERRIDE="zh_CN.UTF-8"
4040
addons:
4141
apt:
4242
packages:
4343
- language-pack-zh-hans
44-
- python: 2.7
44+
- os: linux
4545
env:
4646
- JOB="2.7" TEST_ARGS="--skip-slow" LINT=true
4747
addons:
4848
apt:
4949
packages:
5050
- python-gtk2
51-
- python: 3.5
51+
- os: linux
5252
env:
5353
- JOB="3.5" TEST_ARGS="--skip-slow --skip-network" COVERAGE=true
5454
addons:
5555
apt:
5656
packages:
5757
- xsel
58-
- python: 3.6
58+
- os: linux
5959
env:
6060
- JOB="3.6" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate" CONDA_FORGE=true
61-
addons:
62-
apt:
63-
packages:
64-
- libatlas-base-dev
65-
- gfortran
6661
# In allow_failures
67-
- python: 2.7
62+
- os: linux
6863
env:
6964
- JOB="2.7_SLOW" TEST_ARGS="--only-slow --skip-network"
7065
# In allow_failures
71-
- python: 2.7
66+
- os: linux
7267
env:
7368
- JOB="2.7_BUILD_TEST" TEST_ARGS="--skip-slow" BUILD_TEST=true
7469
# In allow_failures
75-
- python: 3.6
70+
- os: linux
7671
env:
7772
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
7873
# In allow_failures
79-
- python: 3.5
74+
- os: linux
8075
env:
81-
- JOB="3.5_DOC_BUILD" DOC_BUILD=true
76+
- JOB="3.5_DOC" DOC=true
8277
allow_failures:
83-
- python: 2.7
78+
- os: linux
8479
env:
8580
- JOB="2.7_SLOW" TEST_ARGS="--only-slow --skip-network"
86-
- python: 2.7
81+
- os: linux
8782
env:
8883
- JOB="2.7_BUILD_TEST" TEST_ARGS="--skip-slow" BUILD_TEST=true
89-
- python: 3.6
84+
- os: linux
9085
env:
9186
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
92-
- python: 3.5
87+
- os: linux
9388
env:
94-
- JOB="3.5_DOC_BUILD" DOC_BUILD=true
89+
- JOB="3.5_DOC" DOC=true
9590

9691
before_install:
9792
- echo "before_install"

ci/build_docs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [ "$?" != "0" ]; then
1717
fi
1818

1919

20-
if [ x"$DOC_BUILD" != x"" ]; then
20+
if [ "$DOC" ]; then
2121

2222
echo "Will build docs"
2323

ci/install_travis.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ if [ -z "$NOCACHE" ] && [ "${TRAVIS_OS_NAME}" == "linux" ]; then
7777
echo "[ccache]: $ccache"
7878
export CC='ccache gcc'
7979
elif [ -z "$NOCACHE" ] && [ "${TRAVIS_OS_NAME}" == "osx" ]; then
80+
echo "[Install ccache]"
81+
brew install ccache > /dev/null 2>&1
8082
echo "[Using ccache]"
81-
time brew install ccache
8283
export PATH=/usr/local/opt/ccache/libexec:$PATH
8384
gcc=$(which gcc)
8485
echo "[gcc]: $gcc"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
python=3.5*
22
python-dateutil
33
pytz
4-
nomkl
54
numpy
65
cython
File renamed without changes.
File renamed without changes.

ci/script_multi.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ echo "[script multi]"
44

55
source activate pandas
66

7-
# don't run the tests for the doc build
8-
if [ x"$DOC_BUILD" != x"" ]; then
9-
exit 0
10-
fi
11-
127
if [ -n "$LOCALE_OVERRIDE" ]; then
138
export LC_ALL="$LOCALE_OVERRIDE";
149
echo "Setting LC_ALL to $LOCALE_OVERRIDE"
@@ -26,6 +21,8 @@ echo PYTHONHASHSEED=$PYTHONHASHSEED
2621
if [ "$BUILD_TEST" ]; then
2722
cd /tmp
2823
python -c "import pandas; pandas.test(['-n 2'])"
24+
elif [ "$DOC" ]; then
25+
echo "We are not running pytest as this is a doc-build"
2926
elif [ "$COVERAGE" ]; then
3027
echo pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml $TEST_ARGS pandas
3128
pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml $TEST_ARGS pandas

ci/script_single.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ echo "[script_single]"
44

55
source activate pandas
66

7-
# don't run the tests for the doc build
8-
if [ x"$DOC_BUILD" != x"" ]; then
9-
exit 0
10-
fi
11-
127
if [ -n "$LOCALE_OVERRIDE" ]; then
138
export LC_ALL="$LOCALE_OVERRIDE";
149
echo "Setting LC_ALL to $LOCALE_OVERRIDE"
@@ -18,7 +13,9 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
1813
fi
1914

2015
if [ "$BUILD_TEST" ]; then
21-
echo "We are not running pytest as this is simply a build test."
16+
echo "We are not running pytest as this is a build test."
17+
elif [ "$DOC" ]; then
18+
echo "We are not running pytest as this is a doc-build"
2219
elif [ "$COVERAGE" ]; then
2320
echo pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
2421
pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas

doc/source/10min.rst

+21-22
Original file line numberDiff line numberDiff line change
@@ -84,29 +84,28 @@ will be completed:
8484

8585
@verbatim
8686
In [1]: df2.<TAB>
87-
df2.A df2.boxplot
88-
df2.abs df2.C
89-
df2.add df2.clip
90-
df2.add_prefix df2.clip_lower
91-
df2.add_suffix df2.clip_upper
92-
df2.align df2.columns
93-
df2.all df2.combine
94-
df2.any df2.combineAdd
87+
df2.A df2.bool
88+
df2.abs df2.boxplot
89+
df2.add df2.C
90+
df2.add_prefix df2.clip
91+
df2.add_suffix df2.clip_lower
92+
df2.align df2.clip_upper
93+
df2.all df2.columns
94+
df2.any df2.combine
9595
df2.append df2.combine_first
96-
df2.apply df2.combineMult
97-
df2.applymap df2.compound
98-
df2.as_blocks df2.consolidate
99-
df2.asfreq df2.convert_objects
100-
df2.as_matrix df2.copy
101-
df2.astype df2.corr
102-
df2.at df2.corrwith
103-
df2.at_time df2.count
104-
df2.axes df2.cov
105-
df2.B df2.cummax
106-
df2.between_time df2.cummin
107-
df2.bfill df2.cumprod
108-
df2.blocks df2.cumsum
109-
df2.bool df2.D
96+
df2.apply df2.compound
97+
df2.applymap df2.consolidate
98+
df2.as_blocks df2.convert_objects
99+
df2.asfreq df2.copy
100+
df2.as_matrix df2.corr
101+
df2.astype df2.corrwith
102+
df2.at df2.count
103+
df2.at_time df2.cov
104+
df2.axes df2.cummax
105+
df2.B df2.cummin
106+
df2.between_time df2.cumprod
107+
df2.bfill df2.cumsum
108+
df2.blocks df2.D
110109

111110
As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically
112111
tab completed. ``E`` is there as well; the rest of the attributes have been

doc/source/categorical.rst

+9
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ Categories must be unique or a `ValueError` is raised:
230230
except ValueError as e:
231231
print("ValueError: " + str(e))
232232
233+
Categories must also not be ``NaN`` or a `ValueError` is raised:
234+
235+
.. ipython:: python
236+
237+
try:
238+
s.cat.categories = [1,2,np.nan]
239+
except ValueError as e:
240+
print("ValueError: " + str(e))
241+
233242
Appending new categories
234243
~~~~~~~~~~~~~~~~~~~~~~~~
235244

doc/source/ecosystem.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ targets the IPython Notebook environment.
9393

9494
`Plotly’s <https://plot.ly/>`__ `Python API <https://plot.ly/python/>`__ enables interactive figures and web shareability. Maps, 2D, 3D, and live-streaming graphs are rendered with WebGL and `D3.js <http://d3js.org/>`__. The library supports plotting directly from a pandas DataFrame and cloud-based collaboration. Users of `matplotlib, ggplot for Python, and Seaborn <https://plot.ly/python/matplotlib-to-plotly-tutorial/>`__ can convert figures into interactive web-based plots. Plots can be drawn in `IPython Notebooks <https://plot.ly/ipython-notebooks/>`__ , edited with R or MATLAB, modified in a GUI, or embedded in apps and dashboards. Plotly is free for unlimited sharing, and has `cloud <https://plot.ly/product/plans/>`__, `offline <https://plot.ly/python/offline/>`__, or `on-premise <https://plot.ly/product/enterprise/>`__ accounts for private use.
9595

96-
Visualizing Data in Qt applications
97-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96+
`QtPandas <https://github.com/draperjames/qtpandas>`__
97+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9898

9999
Spun off from the main pandas library, the `qtpandas <https://github.com/draperjames/qtpandas>`__
100100
library enables DataFrame visualization and manipulation in PyQt4 and PySide applications.

doc/source/io.rst

+20-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ filepath_or_buffer : various
9191
locations), or any object with a ``read()`` method (such as an open file or
9292
:class:`~python:io.StringIO`).
9393
sep : str, defaults to ``','`` for :func:`read_csv`, ``\t`` for :func:`read_table`
94-
Delimiter to use. If sep is ``None``,
95-
will try to automatically determine this. Separators longer than 1 character
96-
and different from ``'\s+'`` will be interpreted as regular expressions, will
97-
force use of the python parsing engine and will ignore quotes in the data.
98-
Regex example: ``'\\r\\t'``.
94+
Delimiter to use. If sep is ``None``, the C engine cannot automatically detect
95+
the separator, but the Python parsing engine can, meaning the latter will be
96+
used automatically. In addition, separators longer than 1 character and
97+
different from ``'\s+'`` will be interpreted as regular expressions and
98+
will also force the use of the Python parsing engine. Note that regex
99+
delimiters are prone to ignoring quoted data. Regex example: ``'\\r\\t'``.
99100
delimiter : str, default ``None``
100101
Alternative argument name for sep.
101102
delim_whitespace : boolean, default False
@@ -2766,6 +2767,20 @@ indices to be parsed.
27662767
27672768
read_excel('path_to_file.xls', 'Sheet1', parse_cols=[0, 2, 3])
27682769
2770+
2771+
Parsing Dates
2772+
+++++++++++++
2773+
2774+
Datetime-like values are normally automatically converted to the appropriate
2775+
dtype when reading the excel file. But if you have a column of strings that
2776+
*look* like dates (but are not actually formatted as dates in excel), you can
2777+
use the `parse_dates` keyword to parse those strings to datetimes:
2778+
2779+
.. code-block:: python
2780+
2781+
read_excel('path_to_file.xls', 'Sheet1', parse_dates=['date_strings'])
2782+
2783+
27692784
Cell Converters
27702785
+++++++++++++++
27712786

doc/source/text.rst

+5-6
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ following code will cause trouble because of the regular expression meaning of
146146
# We need to escape the special character (for >1 len patterns)
147147
dollars.str.replace(r'-\$', '-')
148148
149-
The ``replace`` method can also take a callable as replacement. It is called
150-
on every ``pat`` using :func:`re.sub`. The callable should expect one
149+
The ``replace`` method can also take a callable as replacement. It is called
150+
on every ``pat`` using :func:`re.sub`. The callable should expect one
151151
positional argument (a regex object) and return a string.
152152

153153
.. versionadded:: 0.20.0
@@ -372,21 +372,20 @@ You can check whether elements contain a pattern:
372372

373373
.. ipython:: python
374374
375-
pattern = r'[a-z][0-9]'
375+
pattern = r'[0-9][a-z]'
376376
pd.Series(['1', '2', '3a', '3b', '03c']).str.contains(pattern)
377377
378378
or match a pattern:
379379

380-
381380
.. ipython:: python
382381
383-
pd.Series(['1', '2', '3a', '3b', '03c']).str.match(pattern, as_indexer=True)
382+
pd.Series(['1', '2', '3a', '3b', '03c']).str.match(pattern)
384383
385384
The distinction between ``match`` and ``contains`` is strictness: ``match``
386385
relies on strict ``re.match``, while ``contains`` relies on ``re.search``.
387386

388387
Methods like ``match``, ``contains``, ``startswith``, and ``endswith`` take
389-
an extra ``na`` argument so missing values can be considered True or False:
388+
an extra ``na`` argument so missing values can be considered True or False:
390389

391390
.. ipython:: python
392391

doc/source/whatsnew/v0.20.0.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ To convert a ``SparseDataFrame`` back to sparse SciPy matrix in COO format, you
270270

271271
.. _whatsnew_0200.enhancements.other:
272272

273-
Other enhancements
273+
Other Enhancements
274274
^^^^^^^^^^^^^^^^^^
275275

276276
- Integration with the ``feather-format``, including a new top-level ``pd.read_feather()`` and ``DataFrame.to_feather()`` method, see :ref:`here <io.feather>`.
@@ -314,6 +314,7 @@ Other enhancements
314314
- ``pd.types.concat.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
315315
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
316316
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
317+
- Re-enable the ``parse_dates`` keyword of ``read_excel`` to parse string columns as dates (:issue:`14326`)
317318

318319
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
319320

@@ -771,7 +772,8 @@ Other API Changes
771772
since pandas version 0.13.0 and can be done with the ``Series.str.extract``
772773
method (:issue:`5224`). As a consequence, the ``as_indexer`` keyword is
773774
ignored (no longer needed to specify the new behaviour) and is deprecated.
774-
775+
- ``NaT`` will now correctly report ``False`` for datetimelike boolean operations such as ``is_month_start`` (:issue:`15781`)
776+
- ``NaT`` will now correctly return ``np.nan`` for ``Timedelta`` and ``Period`` accessors such as ``days`` and ``quarter`` (:issue:`15782`)
775777

776778
.. _whatsnew_0200.deprecations:
777779

@@ -816,9 +818,11 @@ Removal of prior version deprecations/changes
816818
in favor of ``iloc`` and ``iat`` as explained :ref:`here <whatsnew_0170.deprecations>` (:issue:`10711`).
817819
- The deprecated ``DataFrame.iterkv()`` has been removed in favor of ``DataFrame.iteritems()`` (:issue:`10711`)
818820
- The ``Categorical`` constructor has dropped the ``name`` parameter (:issue:`10632`)
821+
- ``Categorical`` has dropped support for ``NaN`` categories (:issue:`10748`)
819822
- The ``take_last`` parameter has been dropped from ``duplicated()``, ``drop_duplicates()``, ``nlargest()``, and ``nsmallest()`` methods (:issue:`10236`, :issue:`10792`, :issue:`10920`)
820823
- ``Series``, ``Index``, and ``DataFrame`` have dropped the ``sort`` and ``order`` methods (:issue:`10726`)
821824
- Where clauses in ``pytables`` are only accepted as strings and expressions types and not other data-types (:issue:`12027`)
825+
- ``DataFrame`` has dropped the ``combineAdd`` and ``combineMult`` methods in favor of ``add`` and ``mul`` respectively (:issue:`10735`)
822826

823827
.. _whatsnew_0200.performance:
824828

@@ -879,6 +883,8 @@ Bug Fixes
879883

880884
- Bug in the display of ``.info()`` where a qualifier (+) would always be displayed with a ``MultiIndex`` that contains only non-strings (:issue:`15245`)
881885
- Bug in ``.replace()`` may result in incorrect dtypes. (:issue:`12747`, :issue:`15765`)
886+
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`)
887+
- Bug in ``Series.replace`` which replaced a numeric by string (:issue:`15743`)
882888

883889
- Bug in ``.asfreq()``, where frequency was not set for empty ``Series`` (:issue:`14320`)
884890

@@ -981,7 +987,6 @@ Bug Fixes
981987

982988
- Bug in ``DataFrame.hist`` where ``plt.tight_layout`` caused an ``AttributeError`` (use ``matplotlib >= 2.0.1``) (:issue:`9351`)
983989
- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)
984-
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`)
985990
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
986991
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
987992
- Bug in ``pd.read_msgpack`` which did not allow to load dataframe with an index of type ``CategoricalIndex`` (:issue:`15487`)

0 commit comments

Comments
 (0)