From 834936b60d56b1e14e2ed4b5a18e977ecfb8f5cb Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Wed, 9 Mar 2016 16:37:13 -0500 Subject: [PATCH 1/2] DOC: clean up some doc-build warnings --- doc/source/dsintro.rst | 1 + doc/source/options.rst | 1 + doc/source/release.rst | 2 +- doc/source/whatsnew/v0.18.0.txt | 5 ++--- pandas/core/frame.py | 14 +++++++++----- pandas/core/generic.py | 24 ++++++++++++++---------- pandas/core/series.py | 6 ++++-- pandas/io/parsers.py | 2 ++ pandas/tseries/tools.py | 7 +++++++ pandas/util/nosetester.py | 13 +++++++++---- 10 files changed, 50 insertions(+), 25 deletions(-) diff --git a/doc/source/dsintro.rst b/doc/source/dsintro.rst index 599724d88bf63..d674ee293e4ed 100644 --- a/doc/source/dsintro.rst +++ b/doc/source/dsintro.rst @@ -692,6 +692,7 @@ R package): .. ipython:: python :suppress: + :okwarning: # restore GlobalPrintConfig pd.reset_option('^display\.') diff --git a/doc/source/options.rst b/doc/source/options.rst index b02765f469d38..170dfda16a467 100644 --- a/doc/source/options.rst +++ b/doc/source/options.rst @@ -438,6 +438,7 @@ For instance: .. ipython:: python :suppress: + :okwarning: pd.reset_option('^display\.') diff --git a/doc/source/release.rst b/doc/source/release.rst index 60d6b15a21a7b..e15175c33e2af 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -12,7 +12,7 @@ import matplotlib.pyplot as plt plt.close('all') - options.display.max_rows=15 + pd.options.display.max_rows=15 import pandas.util.testing as tm ************* diff --git a/doc/source/whatsnew/v0.18.0.txt b/doc/source/whatsnew/v0.18.0.txt index 90ded17286c9f..2c6eb28b9b2f4 100644 --- a/doc/source/whatsnew/v0.18.0.txt +++ b/doc/source/whatsnew/v0.18.0.txt @@ -863,11 +863,10 @@ Previous API will work but deprecations In [7]: r.iloc[0] = 5 ValueError: .resample() is now a deferred operation - use .resample(...).mean() instead of .resample(...) - assignment will have no effect as you are working on a copy + use .resample(...).mean() instead of .resample(...) There is a situation where the new API can not perform all the operations when using original code. - This code is intending to resample every 2s, take the ``mean`` AND then take the ``min` of those results. + This code is intending to resample every 2s, take the ``mean`` AND then take the ``min`` of those results. .. code-block:: python diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 80f3d0d66ca9a..01156252fcd6d 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1627,6 +1627,7 @@ def info(self, verbose=None, buf=None, max_cols=None, memory_usage=None, human-readable units (base-2 representation). null_counts : boolean, default None Whether to show the non-null counts + - If None, then only show if the frame is smaller than max_info_rows and max_info_columns. - If True, always show counts. @@ -4932,6 +4933,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, 0 or 'index' for row-wise, 1 or 'columns' for column-wise interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} .. versionadded:: 0.18.0 + This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points `i` and `j`: @@ -4945,11 +4947,12 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, Returns ------- quantiles : Series or DataFrame - If ``q`` is an array, a DataFrame will be returned where the - index is ``q``, the columns are the columns of self, and the - values are the quantiles. - If ``q`` is a float, a Series will be returned where the - index is the columns of self and the values are the quantiles. + + - If ``q`` is an array, a DataFrame will be returned where the + index is ``q``, the columns are the columns of self, and the + values are the quantiles. + - If ``q`` is a float, a Series will be returned where the + index is the columns of self and the values are the quantiles. Examples -------- @@ -4965,6 +4968,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, 0.1 1.3 3.7 0.5 2.5 55.0 """ + self._check_percentile(q) per = np.asarray(q) * 100 diff --git a/pandas/core/generic.py b/pandas/core/generic.py index bc92733e7c2fd..963c953154b57 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2041,11 +2041,13 @@ def sort_index(self, axis=0, level=None, ascending=True, inplace=False, method to use for filling holes in reindexed DataFrame. Please note: this is only applicable to DataFrames/Series with a monotonically increasing/decreasing index. - * default: don't fill gaps - * pad / ffill: propagate last valid observation forward to next - valid - * backfill / bfill: use next valid observation to fill gap - * nearest: use nearest valid observations to fill gap + + * default: don't fill gaps + * pad / ffill: propagate last valid observation forward to next + valid + * backfill / bfill: use next valid observation to fill gap + * nearest: use nearest valid observations to fill gap + copy : boolean, default True Return a new object, even if the passed indexes are the same level : int or name @@ -2265,11 +2267,13 @@ def _reindex_multi(self, axes, copy, fill_value): axis : %(axes_single_arg)s method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'}, optional Method to use for filling holes in reindexed DataFrame: - * default: don't fill gaps - * pad / ffill: propagate last valid observation forward to next - valid - * backfill / bfill: use next valid observation to fill gap - * nearest: use nearest valid observations to fill gap + + * default: don't fill gaps + * pad / ffill: propagate last valid observation forward to next + valid + * backfill / bfill: use next valid observation to fill gap + * nearest: use nearest valid observations to fill gap + copy : boolean, default True Return a new object, even if the passed indexes are the same level : int or name diff --git a/pandas/core/series.py b/pandas/core/series.py index 5eb1ab0f14ecf..d339a93a3ed9b 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1289,8 +1289,10 @@ def quantile(self, q=0.5, interpolation='linear'): 0 <= q <= 1, the quantile(s) to compute interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} .. versionadded:: 0.18.0 + This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points `i` and `j`: + * linear: `i + (j - i) * fraction`, where `fraction` is the fractional part of the index surrounded by `i` and `j`. * lower: `i`. @@ -1306,15 +1308,15 @@ def quantile(self, q=0.5, interpolation='linear'): Examples -------- - >>> s = Series([1, 2, 3, 4]) >>> s.quantile(.5) - 2.5 + 2.5 >>> s.quantile([.25, .5, .75]) 0.25 1.75 0.50 2.50 0.75 3.25 dtype: float64 + """ self._check_percentile(q) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index f7b38c75a24b9..2604b6e0784cf 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -121,6 +121,7 @@ class ParserWarning(Warning): If True, skip over blank lines rather than interpreting as NaN values parse_dates : boolean or list of ints or names or list of lists or dict, \ default False + * boolean. If True -> try parsing the index. * list of ints or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3 each as a separate date column. @@ -128,6 +129,7 @@ class ParserWarning(Warning): a single date column. * dict, e.g. {'foo' : [1, 3]} -> parse columns 1, 3 as date and call result 'foo' + Note: A fast-path exists for iso8601-formatted dates. infer_datetime_format : boolean, default False If True and parse_dates is enabled for a column, attempt to infer diff --git a/pandas/tseries/tools.py b/pandas/tseries/tools.py index 8f127e28e28a9..d92cfef5280fc 100644 --- a/pandas/tseries/tools.py +++ b/pandas/tseries/tools.py @@ -190,6 +190,7 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, ---------- arg : string, datetime, list, tuple, 1-d array, or Series errors : {'ignore', 'raise', 'coerce'}, default 'raise' + - If 'raise', then invalid parsing will raise an exception - If 'coerce', then invalid parsing will be set as NaT - If 'ignore', then invalid parsing will return the input @@ -201,10 +202,12 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, with day first (this is a known bug, based on dateutil behavior). yearfirst : boolean, default False Specify a date parse order if `arg` is str or its list-likes. + - If True parses dates with the year first, eg 10/11/12 is parsed as 2010-11-12. - If both dayfirst and yearfirst are True, yearfirst is preceded (same as dateutil). + Warning: yearfirst=True is not strict, but will prefer to parse with year first (this is a known bug, based on dateutil beahavior). @@ -214,14 +217,17 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, Return UTC DatetimeIndex if True (converting any tz-aware datetime.datetime objects as well). box : boolean, default True + - If True returns a DatetimeIndex - If False returns ndarray of values. format : string, default None strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse all the way up to nanoseconds. exact : boolean, True by default + - If True, require an exact format match. - If False, allow the format to match anywhere in the target string. + unit : unit of the arg (D,s,ms,us,ns) denote the unit in epoch (e.g. a unix timestamp), which is an integer/float number. infer_datetime_format : boolean, default False @@ -273,6 +279,7 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, datetime.datetime(1300, 1, 1, 0, 0) >>> pd.to_datetime('13000101', format='%Y%m%d', errors='coerce') NaT + """ return _to_datetime(arg, errors=errors, dayfirst=dayfirst, yearfirst=yearfirst, diff --git a/pandas/util/nosetester.py b/pandas/util/nosetester.py index a81fc5cd4b31e..1bdaaff99fd50 100644 --- a/pandas/util/nosetester.py +++ b/pandas/util/nosetester.py @@ -123,7 +123,8 @@ def _get_custom_doctester(self): return None def _test_argv(self, label, verbose, extra_argv): - ''' Generate argv for nosetest command + """ + Generate argv for nosetest command Parameters ---------- @@ -138,7 +139,8 @@ def _test_argv(self, label, verbose, extra_argv): ------- argv : list command line arguments that will be passed to nose - ''' + """ + argv = [__file__, self.package_path] if label and label != 'full': if not isinstance(label, string_types): @@ -170,6 +172,7 @@ def test(self, label='fast', verbose=1, extra_argv=None, Identifies the tests to run. This can be a string to pass to the nosetests executable with the '-A' option, or one of several special values. Special values are: + * 'fast' - the default - which corresponds to the ``nosetests -A`` option of 'not slow'. * 'full' - fast (as above) and slow tests as in the @@ -177,6 +180,7 @@ def test(self, label='fast', verbose=1, extra_argv=None, * None or '' - run all tests. * attribute_identifier - string passed directly to nosetests as '-A'. + verbose : int, optional Verbosity value for test outputs, in the range 1-10. Default is 1. extra_argv : list, optional @@ -191,14 +195,15 @@ def test(self, label='fast', verbose=1, extra_argv=None, This specifies which warnings to configure as 'raise' instead of 'warn' during the test execution. Valid strings are: - - "develop" : equals ``(DeprecationWarning, RuntimeWarning)`` - - "release" : equals ``()``, don't raise on any warnings. + - 'develop' : equals ``(DeprecationWarning, RuntimeWarning)`` + - 'release' : equals ``()``, don't raise on any warnings. Returns ------- result : object Returns the result of running the tests as a ``nose.result.TextTestResult`` object. + """ # cap verbosity at 3 because nose becomes *very* verbose beyond that From f52404d4b7889bcfb685ca1dccd6ac94064e3fa1 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Thu, 10 Mar 2016 11:27:12 -0500 Subject: [PATCH 2/2] CI/BLD: suppress cython warnings --- ci/build_docs.sh | 4 ++++ setup.py | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 12fb8cae4dfc7..8594cd4af34e5 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -36,6 +36,10 @@ if [ x"$DOC_BUILD" != x"" ]; then echo ./make.py ./make.py + echo ######################## + echo # Create and send docs # + echo ######################## + cd /tmp/doc/build/html git config --global user.email "pandas-docs-bot@localhost.foo" git config --global user.name "pandas-docs-bot" diff --git a/setup.py b/setup.py index f33b01b24c165..94fd2998a84e6 100755 --- a/setup.py +++ b/setup.py @@ -439,7 +439,8 @@ def pxd(name): obj = Extension('pandas.%s' % name, sources=sources, depends=data.get('depends', []), - include_dirs=include) + include_dirs=include, + extra_compile_args=['-w']) extensions.append(obj) @@ -447,14 +448,16 @@ def pxd(name): sparse_ext = Extension('pandas._sparse', sources=[srcpath('sparse', suffix=suffix)], include_dirs=[], - libraries=libraries) + libraries=libraries, + extra_compile_args=['-w']) extensions.extend([sparse_ext]) testing_ext = Extension('pandas._testing', sources=[srcpath('testing', suffix=suffix)], include_dirs=[], - libraries=libraries) + libraries=libraries, + extra_compile_args=['-w']) extensions.extend([testing_ext]) @@ -474,7 +477,8 @@ def pxd(name): subdir='msgpack')], language='c++', include_dirs=['pandas/src/msgpack'] + common_include, - define_macros=macros) + define_macros=macros, + extra_compile_args=['-w']) unpacker_ext = Extension('pandas.msgpack._unpacker', depends=['pandas/src/msgpack/unpack.h', 'pandas/src/msgpack/unpack_define.h', @@ -484,7 +488,8 @@ def pxd(name): subdir='msgpack')], language='c++', include_dirs=['pandas/src/msgpack'] + common_include, - define_macros=macros) + define_macros=macros, + extra_compile_args=['-w']) extensions.append(packer_ext) extensions.append(unpacker_ext) @@ -508,7 +513,7 @@ def pxd(name): include_dirs=['pandas/src/ujson/python', 'pandas/src/ujson/lib', 'pandas/src/datetime'] + common_include, - extra_compile_args=['-D_GNU_SOURCE']) + extra_compile_args=['-D_GNU_SOURCE', '-w']) extensions.append(ujson_ext)