Skip to content

Commit

Permalink
Merge branch 'master' into str_infer
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari authored Nov 5, 2018
2 parents 3cc2fae + 391aded commit 5f96220
Show file tree
Hide file tree
Showing 71 changed files with 1,204 additions and 518 deletions.
10 changes: 9 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
flake8 pandas/_libs --filename=*.pxi.in,*.pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
RET=$(($RET + $?)) ; echo $MSG "DONE"

# Check that cython casting is of the form `<type>obj` as opposed to `<type> obj`;
# it doesn't make a difference, but we want to be internally consistent.
# Note: this grep pattern is (intended to be) equivalent to the python
# regex r'(?<![ ->])> '
MSG='Linting .pyx code for spacing conventions in casting' ; echo $MSG
! grep -r -E --include '*.pyx' --include '*.pxi.in' '> ' pandas/_libs | grep -v '[ ->]> '
RET=$(($RET + $?)) ; echo $MSG "DONE"

# readability/casting: Warnings about C casting instead of C++ casting
# runtime/int: Warnings about using C number types instead of C++ ones
# build/include_subdir: Warnings about prefacing included header files with directory
Expand Down Expand Up @@ -123,7 +131,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then

MSG='Doctests frame.py' ; echo $MSG
pytest -q --doctest-modules pandas/core/frame.py \
-k"-axes -combine -itertuples -join -nlargest -nsmallest -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_stata"
-k"-axes -combine -itertuples -join -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_stata"
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Doctests series.py' ; echo $MSG
Expand Down
4 changes: 2 additions & 2 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ We encourage you to view the source code of :meth:`~DataFrame.pipe`.

.. _dplyr: https://github.com/hadley/dplyr
.. _magrittr: https://github.com/smbache/magrittr
.. _R: http://www.r-project.org
.. _R: https://www.r-project.org


Row or Column-wise Function Application
Expand Down Expand Up @@ -2296,7 +2296,7 @@ For example, to select ``bool`` columns:
df.select_dtypes(include=[bool])
You can also pass the name of a dtype in the `NumPy dtype hierarchy
<http://docs.scipy.org/doc/numpy/reference/arrays.scalars.html>`__:
<https://docs.scipy.org/doc/numpy/reference/arrays.scalars.html>`__:

.. ipython:: python
Expand Down
18 changes: 9 additions & 9 deletions doc/source/comparison_with_sas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ Length
~~~~~~

SAS determines the length of a character string with the
`LENGTHN <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002284668.htm>`__
and `LENGTHC <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002283942.htm>`__
`LENGTHN <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002284668.htm>`__
and `LENGTHC <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002283942.htm>`__
functions. ``LENGTHN`` excludes trailing blanks and ``LENGTHC`` includes trailing blanks.

.. code-block:: sas
Expand All @@ -391,7 +391,7 @@ Find
~~~~

SAS determines the position of a character in a string with the
`FINDW <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002978282.htm>`__ function.
`FINDW <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002978282.htm>`__ function.
``FINDW`` takes the string defined by the first argument and searches for the first position of the substring
you supply as the second argument.

Expand All @@ -417,7 +417,7 @@ Substring
~~~~~~~~~

SAS extracts a substring from a string based on its position with the
`SUBSTR <http://www2.sas.com/proceedings/sugi25/25/cc/25p088.pdf>`__ function.
`SUBSTR <https://www2.sas.com/proceedings/sugi25/25/cc/25p088.pdf>`__ function.

.. code-block:: sas
Expand All @@ -438,7 +438,7 @@ indexes are zero-based.
Scan
~~~~

The SAS `SCAN <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm>`__
The SAS `SCAN <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm>`__
function returns the nth word from a string. The first argument is the string you want to parse and the
second argument specifies which word you want to extract.

Expand Down Expand Up @@ -469,9 +469,9 @@ approaches, but this just shows a simple approach.
Upcase, Lowcase, and Propcase
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The SAS `UPCASE <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245965.htm>`__
`LOWCASE <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245912.htm>`__ and
`PROPCASE <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/a002598106.htm>`__
The SAS `UPCASE <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245965.htm>`__
`LOWCASE <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245912.htm>`__ and
`PROPCASE <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/a002598106.htm>`__
functions change the case of the argument.

.. code-block:: sas
Expand Down Expand Up @@ -709,7 +709,7 @@ This means that the size of data able to be loaded in pandas is limited by your
machine's memory, but also that the operations on that data may be faster.

If out of core processing is needed, one possibility is the
`dask.dataframe <http://dask.pydata.org/en/latest/dataframe.html>`_
`dask.dataframe <https://dask.pydata.org/en/latest/dataframe.html>`_
library (currently in development) which
provides a subset of pandas functionality for an on-disk ``DataFrame``

Expand Down
4 changes: 2 additions & 2 deletions doc/source/comparison_with_sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Comparison with SQL
********************
Since many potential pandas users have some familiarity with
`SQL <http://en.wikipedia.org/wiki/SQL>`_, this page is meant to provide some examples of how
`SQL <https://en.wikipedia.org/wiki/SQL>`_, this page is meant to provide some examples of how
various SQL operations would be performed using pandas.

If you're new to pandas, you might want to first read through :ref:`10 Minutes to pandas<10min>`
Expand Down Expand Up @@ -59,7 +59,7 @@ Filtering in SQL is done via a WHERE clause.
LIMIT 5;
DataFrames can be filtered in multiple ways; the most intuitive of which is using
`boolean indexing <http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing>`_.
`boolean indexing <https://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing>`_.

.. ipython:: python
Expand Down
12 changes: 8 additions & 4 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
# JP: added from sphinxdocs
autosummary_generate = False

if any(re.match("\s*api\s*", l) for l in index_rst_lines):
if any(re.match(r"\s*api\s*", l) for l in index_rst_lines):
autosummary_generate = True

# numpydoc
Expand Down Expand Up @@ -341,8 +341,8 @@
# file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pandas.tex',
u'pandas: powerful Python data analysis toolkit',
u'Wes McKinney\n\& PyData Development Team', 'manual'),
'pandas: powerful Python data analysis toolkit',
r'Wes McKinney\n\& PyData Development Team', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -569,7 +569,11 @@ def linkcode_resolve(domain, info):
return None

try:
fn = inspect.getsourcefile(obj)
# inspect.unwrap() was added in Python version 3.4
if sys.version_info >= (3, 5):
fn = inspect.getsourcefile(inspect.unwrap(obj))
else:
fn = inspect.getsourcefile(obj)
except:
fn = None
if not fn:
Expand Down
52 changes: 52 additions & 0 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,54 @@ Alternatively, you can install the ``grep`` and ``xargs`` commands via the
`MinGW <http://www.mingw.org/>`__ toolchain, and it will allow you to run the
commands above.

.. _contributing.import-formatting:

Import Formatting
~~~~~~~~~~~~~~~~~
*pandas* uses `isort <https://pypi.org/project/isort/>`__ to standardise import
formatting across the codebase.

A guide to import layout as per pep8 can be found `here <https://www.python.org/dev/peps/pep-0008/#imports/>`__.

A summary of our current import sections ( in order ):

* Future
* Python Standard Library
* Third Party
* ``pandas._libs``, ``pandas.compat``, ``pandas.util._*``, ``pandas.errors`` (largely not dependent on ``pandas.core``)
* ``pandas.core.dtypes`` (largely not dependent on the rest of ``pandas.core``)
* Rest of ``pandas.core.*``
* Non-core ``pandas.io``, ``pandas.plotting``, ``pandas.tseries``
* Local application/library specific imports

Imports are alphabetically sorted within these sections.


As part of :ref:`Continuous Integration <contributing.ci>` checks we run::

isort --recursive --check-only pandas

to check that imports are correctly formatted as per the `setup.cfg`.

If you see output like the below in :ref:`Continuous Integration <contributing.ci>` checks:

.. code-block:: shell
Check import format using isort
ERROR: /home/travis/build/pandas-dev/pandas/pandas/io/pytables.py Imports are incorrectly sorted
Check import format using isort DONE
The command "ci/code_checks.sh" exited with 1
You should run::

isort pandas/io/pytables.py

to automatically format imports correctly. This will modify your local copy of the files.

The `--recursive` flag can be passed to sort all files in a directory.

You can then verify the changes look ok, then git :ref:`commit <contributing.commit-code>` and :ref:`push <contributing.push-code>`.

Backwards Compatibility
~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1078,6 +1126,8 @@ or a new keyword argument (`example <https://github.com/pandas-dev/pandas/blob/v
Contributing your changes to *pandas*
=====================================

.. _contributing.commit-code:

Committing your code
--------------------

Expand Down Expand Up @@ -1122,6 +1172,8 @@ Now you can commit your changes in your local repository::

git commit -m

.. _contributing.push-code:

Pushing your changes
--------------------

Expand Down
8 changes: 4 additions & 4 deletions doc/source/contributing_docstring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function or method, so programmers can understand what it does without having
to read the details of the implementation.

Also, it is a common practice to generate online (html) documentation
automatically from docstrings. `Sphinx <http://www.sphinx-doc.org>`_ serves
automatically from docstrings. `Sphinx <https://www.sphinx-doc.org>`_ serves
this purpose.

Next example gives an idea on how a docstring looks like:
Expand Down Expand Up @@ -68,7 +68,7 @@ As PEP-257 is quite open, and some other standards exist on top of it. In the
case of pandas, the numpy docstring convention is followed. The conventions is
explained in this document:

* `numpydoc docstring guide <http://numpydoc.readthedocs.io/en/latest/format.html>`_
* `numpydoc docstring guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_
(which is based in the original `Guide to NumPy/SciPy documentation
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_)

Expand All @@ -78,7 +78,7 @@ The standard uses reStructuredText (reST). reStructuredText is a markup
language that allows encoding styles in plain text files. Documentation
about reStructuredText can be found in:

* `Sphinx reStructuredText primer <http://www.sphinx-doc.org/en/stable/rest.html>`_
* `Sphinx reStructuredText primer <https://www.sphinx-doc.org/en/stable/rest.html>`_
* `Quick reStructuredText reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_
* `Full reStructuredText specification <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_

Expand Down Expand Up @@ -119,7 +119,7 @@ backticks. It is considered inline code:
function, prefix it with ``~``. For example, ``:class:`~pandas.Series```
will link to ``pandas.Series`` but only display the last part, ``Series``
as the link text. See `Sphinx cross-referencing syntax
<http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax>`_
<https://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax>`_
for details.

**Good:**
Expand Down
Loading

0 comments on commit 5f96220

Please sign in to comment.