diff --git a/.gitignore b/.gitignore index f912fedb199c0a..4598714db6c6a8 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,7 @@ asv_bench/pandas/ # Documentation generated files # ################################# doc/source/generated +doc/source/api/generated doc/source/_static doc/source/vbench doc/source/vbench.rst diff --git a/.travis.yml b/.travis.yml index 28b57cc750190a..9f6a5f0c5d9aa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,11 +34,11 @@ matrix: include: - dist: trusty env: - - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network and not db" + - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network" - dist: trusty env: - - JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="not slow" + - JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="not slow and db" addons: apt: packages: @@ -46,11 +46,11 @@ matrix: - dist: trusty env: - - JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="not slow and not network" LOCALE_OVERRIDE="zh_CN.UTF-8" + - JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="not slow and not network and db" LOCALE_OVERRIDE="zh_CN.UTF-8" - dist: trusty env: - - JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="not slow and not network" PANDAS_TESTING_MODE="deprecate" COVERAGE=true + - JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="not slow and not network and db" PANDAS_TESTING_MODE="deprecate" COVERAGE=true # In allow_failures - dist: trusty diff --git a/ci/azure/posix.yml b/ci/azure/posix.yml index c0c4fb924a605a..b9e0cd0b9258ce 100644 --- a/ci/azure/posix.yml +++ b/ci/azure/posix.yml @@ -12,37 +12,37 @@ jobs: py35_np_120: ENV_FILE: ci/deps/azure-macos-35.yaml CONDA_PY: "35" - PATTERN: "not slow and not network and not db" + PATTERN: "not slow and not network" ${{ if eq(parameters.name, 'Linux') }}: py27_np_120: ENV_FILE: ci/deps/azure-27-compat.yaml CONDA_PY: "27" - PATTERN: "not slow and not network and not db" + PATTERN: "not slow and not network" py27_locale_slow_old_np: ENV_FILE: ci/deps/azure-27-locale.yaml CONDA_PY: "27" - PATTERN: "slow and not db" + PATTERN: "slow" LOCALE_OVERRIDE: "zh_CN.UTF-8" EXTRA_APT: "language-pack-zh-hans" py36_locale_slow: ENV_FILE: ci/deps/azure-36-locale_slow.yaml CONDA_PY: "36" - PATTERN: "not slow and not network and not db" + PATTERN: "not slow and not network" LOCALE_OVERRIDE: "it_IT.UTF-8" py37_locale: ENV_FILE: ci/deps/azure-37-locale.yaml CONDA_PY: "37" - PATTERN: "not slow and not network and not db" + PATTERN: "not slow and not network" LOCALE_OVERRIDE: "zh_CN.UTF-8" py37_np_dev: ENV_FILE: ci/deps/azure-37-numpydev.yaml CONDA_PY: "37" - PATTERN: "not slow and not network and not db" + PATTERN: "not slow and not network" TEST_ARGS: "-W error" PANDAS_TESTING_MODE: "deprecate" EXTRA_APT: "xsel" diff --git a/ci/azure/windows.yml b/ci/azure/windows.yml index f06b229bb26563..cece0020249369 100644 --- a/ci/azure/windows.yml +++ b/ci/azure/windows.yml @@ -38,7 +38,7 @@ jobs: displayName: 'Build' - script: | call activate pandas-dev - pytest -m "not slow and not network and not db" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %* + pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %* displayName: 'Test' - task: PublishTestResults@2 inputs: diff --git a/ci/deps/azure-macos-35.yaml b/ci/deps/azure-macos-35.yaml index 7a0c3b81ac8f9d..b6dc2b3c27e8d9 100644 --- a/ci/deps/azure-macos-35.yaml +++ b/ci/deps/azure-macos-35.yaml @@ -13,6 +13,8 @@ dependencies: - numexpr - numpy=1.12.0 - openpyxl=2.5.5 + - pyarrow + - fastparquet - pytables - python=3.5* - pytz diff --git a/doc/make.py b/doc/make.py index b3ea2b7a6f5fe0..19be78a8101ce1 100755 --- a/doc/make.py +++ b/doc/make.py @@ -15,11 +15,9 @@ import sys import os import shutil -# import subprocess +import subprocess import argparse -from contextlib import contextmanager import webbrowser -import jinja2 DOC_PATH = os.path.dirname(os.path.abspath(__file__)) @@ -28,179 +26,68 @@ BUILD_DIRS = ['doctrees', 'html', 'latex', 'plots', '_static', '_templates'] -@contextmanager -def _maybe_exclude_notebooks(): - """Skip building the notebooks if pandoc is not installed. - - This assumes that nbsphinx is installed. - - Skip notebook conversion if: - 1. nbconvert isn't installed, or - 2. nbconvert is installed, but pandoc isn't - """ - # TODO move to exclude_pattern - base = os.path.dirname(__file__) - notebooks = [os.path.join(base, 'source', nb) - for nb in ['style.ipynb']] - contents = {} - - def _remove_notebooks(): - for nb in notebooks: - with open(nb, 'rt') as f: - contents[nb] = f.read() - os.remove(nb) - - try: - import nbconvert - except ImportError: - sys.stderr.write('Warning: nbconvert not installed. ' - 'Skipping notebooks.\n') - _remove_notebooks() - else: - try: - nbconvert.utils.pandoc.get_pandoc_version() - except nbconvert.utils.pandoc.PandocMissing: - sys.stderr.write('Warning: Pandoc is not installed. ' - 'Skipping notebooks.\n') - _remove_notebooks() - - yield - - for nb, content in contents.items(): - with open(nb, 'wt') as f: - f.write(content) - - class DocBuilder: - """Class to wrap the different commands of this script. + """ + Class to wrap the different commands of this script. All public methods of this class can be called as parameters of the script. """ - def __init__(self, num_jobs=1, include_api=True, single_doc=None, - verbosity=0): + def __init__(self, num_jobs=0, include_api=True, single_doc=None, + verbosity=0, warnings_are_errors=False): self.num_jobs = num_jobs - self.include_api = include_api self.verbosity = verbosity - self.single_doc = None - self.single_doc_type = None - if single_doc is not None: - self._process_single_doc(single_doc) - self.exclude_patterns = self._exclude_patterns - - self._generate_index() - if self.single_doc_type == 'docstring': - self._run_os('sphinx-autogen', '-o', - 'source/generated_single', 'source/index.rst') - - @property - def _exclude_patterns(self): - """Docs source files that will be excluded from building.""" - # TODO move maybe_exclude_notebooks here - if self.single_doc is not None: - rst_files = [f for f in os.listdir(SOURCE_PATH) - if ((f.endswith('.rst') or f.endswith('.ipynb')) - and (f != 'index.rst') - and (f != '{0}.rst'.format(self.single_doc)))] - if self.single_doc_type != 'api': - rst_files += ['generated/*.rst'] - elif not self.include_api: - rst_files = ['api.rst', 'generated/*.rst'] - else: - rst_files = ['generated_single/*.rst'] - - exclude_patterns = ','.join( - '{!r}'.format(i) for i in ['**.ipynb_checkpoints'] + rst_files) - - return exclude_patterns + self.warnings_are_errors = warnings_are_errors + + if single_doc: + single_doc = self._process_single_doc(single_doc) + include_api = False + os.environ['SPHINX_PATTERN'] = single_doc + elif not include_api: + os.environ['SPHINX_PATTERN'] = '-api' + + self.single_doc_html = None + if single_doc and single_doc.endswith('.rst'): + self.single_doc_html = os.path.splitext(single_doc)[0] + '.html' + elif single_doc: + self.single_doc_html = 'api/generated/pandas.{}.html'.format( + single_doc) def _process_single_doc(self, single_doc): - """Extract self.single_doc (base name) and self.single_doc_type from - passed single_doc kwarg. - """ - self.include_api = False - - if single_doc == 'api.rst' or single_doc == 'api': - self.single_doc_type = 'api' - self.single_doc = 'api' - elif os.path.exists(os.path.join(SOURCE_PATH, single_doc)): - self.single_doc_type = 'rst' + Make sure the provided value for --single is a path to an existing + .rst/.ipynb file, or a pandas object that can be imported. - if 'whatsnew' in single_doc: - basename = single_doc + For example, categorial.rst or pandas.DataFrame.head. For the latter, + return the corresponding file path + (e.g. generated/pandas.DataFrame.head.rst). + """ + base_name, extension = os.path.splitext(single_doc) + if extension in ('.rst', '.ipynb'): + if os.path.exists(os.path.join(SOURCE_PATH, single_doc)): + return single_doc else: - basename = os.path.basename(single_doc) - self.single_doc = os.path.splitext(basename)[0] - elif os.path.exists( - os.path.join(SOURCE_PATH, '{}.rst'.format(single_doc))): - self.single_doc_type = 'rst' - self.single_doc = single_doc - elif single_doc is not None: + raise FileNotFoundError('File {} not found'.format(single_doc)) + + elif single_doc.startswith('pandas.'): try: obj = pandas # noqa: F821 for name in single_doc.split('.'): obj = getattr(obj, name) except AttributeError: - raise ValueError('Single document not understood, it should ' - 'be a file in doc/source/*.rst (e.g. ' - '"contributing.rst" or a pandas function or ' - 'method (e.g. "pandas.DataFrame.head")') + raise ImportError('Could not import {}'.format(single_doc)) else: - self.single_doc_type = 'docstring' - if single_doc.startswith('pandas.'): - self.single_doc = single_doc[len('pandas.'):] - else: - self.single_doc = single_doc - - def _copy_generated_docstring(self): - """Copy existing generated (from api.rst) docstring page because - this is more correct in certain cases (where a custom autodoc - template is used). - - """ - fname = os.path.join(SOURCE_PATH, 'generated', - 'pandas.{}.rst'.format(self.single_doc)) - temp_dir = os.path.join(SOURCE_PATH, 'generated_single') - - try: - os.makedirs(temp_dir) - except OSError: - pass - - if os.path.exists(fname): - try: - # copying to make sure sphinx always thinks it is new - # and needs to be re-generated (to pick source code changes) - shutil.copy(fname, temp_dir) - except: # noqa - pass - - def _generate_index(self): - """Create index.rst file with the specified sections.""" - if self.single_doc_type == 'docstring': - self._copy_generated_docstring() - - with open(os.path.join(SOURCE_PATH, 'index.rst.template')) as f: - t = jinja2.Template(f.read()) - - with open(os.path.join(SOURCE_PATH, 'index.rst'), 'w') as f: - f.write(t.render(include_api=self.include_api, - single_doc=self.single_doc, - single_doc_type=self.single_doc_type)) - - @staticmethod - def _create_build_structure(): - """Create directories required to build documentation.""" - for dirname in BUILD_DIRS: - try: - os.makedirs(os.path.join(BUILD_PATH, dirname)) - except OSError: - pass + return single_doc[len('pandas.'):] + else: + raise ValueError(('--single={} not understood. Value should be a ' + 'valid path to a .rst or .ipynb file, or a ' + 'valid pandas object (e.g. categorical.rst or ' + 'pandas.DataFrame.head)').format(single_doc)) @staticmethod def _run_os(*args): - """Execute a command as a OS terminal. + """ + Execute a command as a OS terminal. Parameters ---------- @@ -211,16 +98,11 @@ def _run_os(*args): -------- >>> DocBuilder()._run_os('python', '--version') """ - # TODO check_call should be more safe, but it fails with - # exclude patterns, needs investigation - # subprocess.check_call(args, stderr=subprocess.STDOUT) - exit_status = os.system(' '.join(args)) - if exit_status: - msg = 'Command "{}" finished with exit code {}' - raise RuntimeError(msg.format(' '.join(args), exit_status)) + subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr) def _sphinx_build(self, kind): - """Call sphinx to build documentation. + """ + Call sphinx to build documentation. Attribute `num_jobs` from the class is used. @@ -236,43 +118,44 @@ def _sphinx_build(self, kind): raise ValueError('kind must be html or latex, ' 'not {}'.format(kind)) - self._run_os('sphinx-build', - '-j{}'.format(self.num_jobs), - '-b{}'.format(kind), - '-{}'.format( - 'v' * self.verbosity) if self.verbosity else '', - '-d"{}"'.format(os.path.join(BUILD_PATH, 'doctrees')), - '-Dexclude_patterns={}'.format(self.exclude_patterns), - '"{}"'.format(SOURCE_PATH), - '"{}"'.format(os.path.join(BUILD_PATH, kind))) - - def _open_browser(self): - base_url = os.path.join('file://', DOC_PATH, 'build', 'html') - if self.single_doc_type == 'docstring': - url = os.path.join( - base_url, - 'generated_single', 'pandas.{}.html'.format(self.single_doc)) - else: - url = os.path.join(base_url, '{}.html'.format(self.single_doc)) + self.clean() + + cmd = ['sphinx-build', '-b', kind] + if self.num_jobs: + cmd += ['-j', str(self.num_jobs)] + if self.warnings_are_errors: + cmd.append('-W') + if self.verbosity: + cmd.append('-{}'.format('v' * self.verbosity)) + cmd += ['-d', os.path.join(BUILD_PATH, 'doctrees'), + SOURCE_PATH, os.path.join(BUILD_PATH, kind)] + cmd = ['sphinx-build', SOURCE_PATH, os.path.join(BUILD_PATH, kind)] + self._run_os(*cmd) + + def _open_browser(self, single_doc_html): + """ + Open a browser tab showing single + """ + url = os.path.join('file://', DOC_PATH, 'build', 'html', + single_doc_html) webbrowser.open(url, new=2) def html(self): - """Build HTML documentation.""" - self._create_build_structure() - with _maybe_exclude_notebooks(): - self._sphinx_build('html') - zip_fname = os.path.join(BUILD_PATH, 'html', 'pandas.zip') - if os.path.exists(zip_fname): - os.remove(zip_fname) - - if self.single_doc is not None: - self._open_browser() - shutil.rmtree(os.path.join(SOURCE_PATH, 'generated_single'), - ignore_errors=True) + """ + Build HTML documentation. + """ + self._sphinx_build('html') + zip_fname = os.path.join(BUILD_PATH, 'html', 'pandas.zip') + if os.path.exists(zip_fname): + os.remove(zip_fname) + + if self.single_doc_html is not None: + self._open_browser(self.single_doc_html) def latex(self, force=False): - """Build PDF documentation.""" - self._create_build_structure() + """ + Build PDF documentation. + """ if sys.platform == 'win32': sys.stderr.write('latex build has not been tested on windows\n') else: @@ -289,18 +172,24 @@ def latex(self, force=False): self._run_os('make') def latex_forced(self): - """Build PDF documentation with retries to find missing references.""" + """ + Build PDF documentation with retries to find missing references. + """ self.latex(force=True) @staticmethod def clean(): - """Clean documentation generated files.""" + """ + Clean documentation generated files. + """ shutil.rmtree(BUILD_PATH, ignore_errors=True) - shutil.rmtree(os.path.join(SOURCE_PATH, 'generated'), + shutil.rmtree(os.path.join(SOURCE_PATH, 'api', 'generated'), ignore_errors=True) def zip_html(self): - """Compress HTML documentation into a zip file.""" + """ + Compress HTML documentation into a zip file. + """ zip_fname = os.path.join(BUILD_PATH, 'html', 'pandas.zip') if os.path.exists(zip_fname): os.remove(zip_fname) @@ -326,7 +215,7 @@ def main(): help='command to run: {}'.format(', '.join(cmds))) argparser.add_argument('--num-jobs', type=int, - default=1, + default=0, help='number of jobs used by sphinx-build') argparser.add_argument('--no-api', default=False, @@ -345,6 +234,9 @@ def main(): argparser.add_argument('-v', action='count', dest='verbosity', default=0, help=('increase verbosity (can be repeated), ' 'passed to the sphinx build command')) + argparser.add_argument('--warnings-are-errors', '-W', + action='store_true', + help='fail if warnings are raised') args = argparser.parse_args() if args.command not in cmds: @@ -364,7 +256,7 @@ def main(): os.environ['MPLBACKEND'] = 'module://matplotlib.backends.backend_agg' builder = DocBuilder(args.num_jobs, not args.no_api, args.single, - args.verbosity) + args.verbosity, args.warnings_are_errors) getattr(builder, args.command)() diff --git a/doc/source/advanced.rst b/doc/source/advanced.rst index e681cb59f627fa..9981310b4a6fbd 100644 --- a/doc/source/advanced.rst +++ b/doc/source/advanced.rst @@ -921,7 +921,7 @@ If you need integer based selection, you should use ``iloc``: dfir.iloc[0:5] -.. _indexing.intervallindex: +.. _advanced.intervallindex: IntervalIndex ~~~~~~~~~~~~~ diff --git a/doc/source/api.rst b/doc/source/api.rst deleted file mode 100644 index d4f1f5c0cdaf49..00000000000000 --- a/doc/source/api.rst +++ /dev/null @@ -1,4116 +0,0 @@ -.. The currentmodule is needed here because the autosummary generation of files -.. happens before reading the files / substituting the header. -.. See https://github.com/pandas-dev/pandas/pull/24232 - -.. currentmodule:: pandas - -.. _api: - -{{ header }} - -************* -API Reference -************* - -This page gives an overview of all public pandas objects, functions and -methods. All classes and functions exposed in ``pandas.*`` namespace are public. - -Some subpackages are public which include ``pandas.errors``, -``pandas.plotting``, and ``pandas.testing``. Public functions in -``pandas.io`` and ``pandas.tseries`` submodules are mentioned in -the documentation. ``pandas.api.types`` subpackage holds some -public functions related to data types in pandas. - - -.. warning:: - - The ``pandas.core``, ``pandas.compat``, and ``pandas.util`` top-level modules are PRIVATE. Stable functionality in such modules is not guaranteed. - - -.. _api.functions: - -Input/Output ------------- - -Pickling -~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_pickle - -Flat File -~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_table - read_csv - read_fwf - read_msgpack - -Clipboard -~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_clipboard - -Excel -~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_excel - ExcelFile.parse - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - ExcelWriter - -JSON -~~~~ - -.. autosummary:: - :toctree: generated/ - - read_json - -.. currentmodule:: pandas.io.json - -.. autosummary:: - :toctree: generated/ - - json_normalize - build_table_schema - -.. currentmodule:: pandas - -HTML -~~~~ - -.. autosummary:: - :toctree: generated/ - - read_html - -HDFStore: PyTables (HDF5) -~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_hdf - HDFStore.put - HDFStore.append - HDFStore.get - HDFStore.select - HDFStore.info - HDFStore.keys - HDFStore.groups - HDFStore.walk - -Feather -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_feather - -Parquet -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_parquet - -SAS -~~~ - -.. autosummary:: - :toctree: generated/ - - read_sas - -SQL -~~~ - -.. autosummary:: - :toctree: generated/ - - read_sql_table - read_sql_query - read_sql - -Google BigQuery -~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_gbq - - -STATA -~~~~~ - -.. autosummary:: - :toctree: generated/ - - read_stata - -.. currentmodule:: pandas.io.stata - -.. autosummary:: - :toctree: generated/ - - StataReader.data - StataReader.data_label - StataReader.value_labels - StataReader.variable_labels - StataWriter.write_file - -.. currentmodule:: pandas - -General functions ------------------ - -Data manipulations -~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - melt - pivot - pivot_table - crosstab - cut - qcut - merge - merge_ordered - merge_asof - concat - get_dummies - factorize - unique - wide_to_long - -Top-level missing data -~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - isna - isnull - notna - notnull - -Top-level conversions -~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - to_numeric - -Top-level dealing with datetimelike -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - to_datetime - to_timedelta - date_range - bdate_range - period_range - timedelta_range - infer_freq - -Top-level dealing with intervals -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - interval_range - -Top-level evaluation -~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - eval - -Hashing -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - util.hash_array - util.hash_pandas_object - -Testing -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - test - -.. _api.series: - -Series ------- - -Constructor -~~~~~~~~~~~ - -.. currentmodule:: pandas - -.. autosummary:: - :toctree: generated/ - - Series - -Attributes -~~~~~~~~~~ -**Axes** - -.. autosummary:: - :toctree: generated/ - - Series.index - -.. autosummary:: - :toctree: generated/ - - Series.values - Series.dtype - Series.ftype - Series.shape - Series.nbytes - Series.ndim - Series.size - Series.strides - Series.itemsize - Series.base - Series.T - Series.memory_usage - Series.hasnans - Series.flags - Series.empty - Series.dtypes - Series.ftypes - Series.data - Series.is_copy - Series.name - Series.put - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.astype - Series.infer_objects - Series.convert_objects - Series.copy - Series.bool - Series.to_period - Series.to_timestamp - Series.to_list - Series.get_values - - -Indexing, iteration -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.get - Series.at - Series.iat - Series.loc - Series.iloc - Series.__iter__ - Series.iteritems - Series.items - Series.keys - Series.pop - Series.item - Series.xs - -For more information on ``.at``, ``.iat``, ``.loc``, and -``.iloc``, see the :ref:`indexing documentation `. - -Binary operator functions -~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.add - Series.sub - Series.mul - Series.div - Series.truediv - Series.floordiv - Series.mod - Series.pow - Series.radd - Series.rsub - Series.rmul - Series.rdiv - Series.rtruediv - Series.rfloordiv - Series.rmod - Series.rpow - Series.combine - Series.combine_first - Series.round - Series.lt - Series.gt - Series.le - Series.ge - Series.ne - Series.eq - Series.product - Series.dot - -Function application, GroupBy & Window -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.apply - Series.agg - Series.aggregate - Series.transform - Series.map - Series.groupby - Series.rolling - Series.expanding - Series.ewm - Series.pipe - -.. _api.series.stats: - -Computations / Descriptive Stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.abs - Series.all - Series.any - Series.autocorr - Series.between - Series.clip - Series.clip_lower - Series.clip_upper - Series.corr - Series.count - Series.cov - Series.cummax - Series.cummin - Series.cumprod - Series.cumsum - Series.describe - Series.diff - Series.factorize - Series.kurt - Series.mad - Series.max - Series.mean - Series.median - Series.min - Series.mode - Series.nlargest - Series.nsmallest - Series.pct_change - Series.prod - Series.quantile - Series.rank - Series.sem - Series.skew - Series.std - Series.sum - Series.var - Series.kurtosis - Series.unique - Series.nunique - Series.is_unique - Series.is_monotonic - Series.is_monotonic_increasing - Series.is_monotonic_decreasing - Series.value_counts - Series.compound - Series.nonzero - - -Reindexing / Selection / Label manipulation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.align - Series.drop - Series.droplevel - Series.drop_duplicates - Series.duplicated - Series.equals - Series.first - Series.head - Series.idxmax - Series.idxmin - Series.isin - Series.last - Series.reindex - Series.reindex_like - Series.rename - Series.rename_axis - Series.reset_index - Series.sample - Series.select - Series.set_axis - Series.take - Series.tail - Series.truncate - Series.where - Series.mask - Series.add_prefix - Series.add_suffix - Series.filter - -Missing data handling -~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.isna - Series.notna - Series.dropna - Series.fillna - Series.interpolate - -Reshaping, sorting -~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.argsort - Series.argmin - Series.argmax - Series.reorder_levels - Series.sort_values - Series.sort_index - Series.swaplevel - Series.unstack - Series.searchsorted - Series.ravel - Series.repeat - Series.squeeze - Series.view - - -Combining / joining / merging -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.append - Series.replace - Series.update - -Time series-related -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.asfreq - Series.asof - Series.shift - Series.first_valid_index - Series.last_valid_index - Series.resample - Series.tz_convert - Series.tz_localize - Series.at_time - Series.between_time - Series.tshift - Series.slice_shift - -Datetimelike Properties -~~~~~~~~~~~~~~~~~~~~~~~ - -``Series.dt`` can be used to access the values of the series as -datetimelike and return several properties. -These can be accessed like ``Series.dt.``. - -**Datetime Properties** - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_attribute.rst - - Series.dt.date - Series.dt.time - Series.dt.timetz - Series.dt.year - Series.dt.month - Series.dt.day - Series.dt.hour - Series.dt.minute - Series.dt.second - Series.dt.microsecond - Series.dt.nanosecond - Series.dt.week - Series.dt.weekofyear - Series.dt.dayofweek - Series.dt.weekday - Series.dt.dayofyear - Series.dt.quarter - Series.dt.is_month_start - Series.dt.is_month_end - Series.dt.is_quarter_start - Series.dt.is_quarter_end - Series.dt.is_year_start - Series.dt.is_year_end - Series.dt.is_leap_year - Series.dt.daysinmonth - Series.dt.days_in_month - Series.dt.tz - Series.dt.freq - -**Datetime Methods** - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - Series.dt.to_period - Series.dt.to_pydatetime - Series.dt.tz_localize - Series.dt.tz_convert - Series.dt.normalize - Series.dt.strftime - Series.dt.round - Series.dt.floor - Series.dt.ceil - Series.dt.month_name - Series.dt.day_name - -**Period Properties** - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_attribute.rst - - Series.dt.qyear - Series.dt.start_time - Series.dt.end_time - -**Timedelta Properties** - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_attribute.rst - - Series.dt.days - Series.dt.seconds - Series.dt.microseconds - Series.dt.nanoseconds - Series.dt.components - -**Timedelta Methods** - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - Series.dt.to_pytimedelta - Series.dt.total_seconds - -String handling -~~~~~~~~~~~~~~~ -``Series.str`` can be used to access the values of the series as -strings and apply several methods to it. These can be accessed like -``Series.str.``. - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - Series.str.capitalize - Series.str.cat - Series.str.center - Series.str.contains - Series.str.count - Series.str.decode - Series.str.encode - Series.str.endswith - Series.str.extract - Series.str.extractall - Series.str.find - Series.str.findall - Series.str.get - Series.str.index - Series.str.join - Series.str.len - Series.str.ljust - Series.str.lower - Series.str.lstrip - Series.str.match - Series.str.normalize - Series.str.pad - Series.str.partition - Series.str.repeat - Series.str.replace - Series.str.rfind - Series.str.rindex - Series.str.rjust - Series.str.rpartition - Series.str.rstrip - Series.str.slice - Series.str.slice_replace - Series.str.split - Series.str.rsplit - Series.str.startswith - Series.str.strip - Series.str.swapcase - Series.str.title - Series.str.translate - Series.str.upper - Series.str.wrap - Series.str.zfill - Series.str.isalnum - Series.str.isalpha - Series.str.isdigit - Series.str.isspace - Series.str.islower - Series.str.isupper - Series.str.istitle - Series.str.isnumeric - Series.str.isdecimal - Series.str.get_dummies - -.. - The following is needed to ensure the generated pages are created with the - correct template (otherwise they would be created in the Series/Index class page) - -.. - .. autosummary:: - :toctree: generated/ - :template: autosummary/accessor.rst - - Series.str - Series.cat - Series.dt - Index.str - - -.. _api.arrays: - -Arrays ------- - -Pandas and third-party libraries can extend NumPy's type system (see :ref:`extending.extension-types`). - -.. autosummary:: - :toctree: generated/ - - array - -.. _api.categorical: - -Categorical -~~~~~~~~~~~ - -Pandas defines a custom data type for representing data that can take only a -limited, fixed set of values. The dtype of a ``Categorical`` can be described by -a :class:`pandas.api.types.CategoricalDtype`. - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - api.types.CategoricalDtype - -.. autosummary:: - :toctree: generated/ - - api.types.CategoricalDtype.categories - api.types.CategoricalDtype.ordered - -Categorical data can be stored in a :class:`pandas.Categorical` - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - Categorical - - -The alternative :meth:`Categorical.from_codes` constructor can be used when you -have the categories and integer codes already: - -.. autosummary:: - :toctree: generated/ - - Categorical.from_codes - -The dtype information is available on the ``Categorical`` - -.. autosummary:: - :toctree: generated/ - - Categorical.dtype - Categorical.categories - Categorical.ordered - Categorical.codes - -``np.asarray(categorical)`` works by implementing the array interface. Be aware, that this converts -the Categorical back to a NumPy array, so categories and order information is not preserved! - -.. autosummary:: - :toctree: generated/ - - Categorical.__array__ - -A ``Categorical`` can be stored in a ``Series`` or ``DataFrame``. -To create a Series of dtype ``category``, use ``cat = s.astype(dtype)`` or -``Series(..., dtype=dtype)`` where ``dtype`` is either - -* the string ``'category'`` -* an instance of :class:`~pandas.api.types.CategoricalDtype`. - -If the Series is of dtype ``CategoricalDtype``, ``Series.cat`` can be used to change the categorical -data. This accessor is similar to the ``Series.dt`` or ``Series.str`` and has the -following usable methods and properties: - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_attribute.rst - - Series.cat.categories - Series.cat.ordered - Series.cat.codes - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - Series.cat.rename_categories - Series.cat.reorder_categories - Series.cat.add_categories - Series.cat.remove_categories - Series.cat.remove_unused_categories - Series.cat.set_categories - Series.cat.as_ordered - Series.cat.as_unordered - -.. _api.arrays.integerna: - -Integer-NA -~~~~~~~~~~ - -:class:`arrays.IntegerArray` can hold integer data, potentially with missing -values. - -.. autosummary:: - :toctree: generated/ - - arrays.IntegerArray - -.. _api.arrays.interval: - -Interval -~~~~~~~~ - -:class:`IntervalArray` is an array for storing data representing intervals. -The scalar type is a :class:`Interval`. These may be stored in a :class:`Series` -or as a :class:`IntervalIndex`. :class:`IntervalArray` can be closed on the -``'left'``, ``'right'``, or ``'both'``, or ``'neither'`` sides. -See :ref:`indexing.intervallindex` for more. - -.. currentmodule:: pandas - -.. autosummary:: - :toctree: generated/ - - IntervalArray - -.. _api.arrays.period: - -Period -~~~~~~ - -Periods represent a span of time (e.g. the year 2000, or the hour from 11:00 to 12:00 -on January 1st, 2000). A collection of :class:`Period` objects with a common frequency -can be collected in a :class:`PeriodArray`. See :ref:`timeseries.periods` for more. - -.. autosummary:: - :toctree: generated/ - - arrays.PeriodArray - -Sparse -~~~~~~ - -Sparse data may be stored and operated on more efficiently when there is a single value -that's often repeated. :class:`SparseArray` is a container for this type of data. -See :ref:`sparse` for more. - -.. _api.arrays.sparse: - -.. autosummary:: - :toctree: generated/ - - SparseArray - -Plotting -~~~~~~~~ - -``Series.plot`` is both a callable method and a namespace attribute for -specific plotting methods of the form ``Series.plot.``. - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_callable.rst - - Series.plot - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - Series.plot.area - Series.plot.bar - Series.plot.barh - Series.plot.box - Series.plot.density - Series.plot.hist - Series.plot.kde - Series.plot.line - Series.plot.pie - -.. autosummary:: - :toctree: generated/ - - Series.hist - -Serialization / IO / Conversion -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Series.to_pickle - Series.to_csv - Series.to_dict - Series.to_excel - Series.to_frame - Series.to_xarray - Series.to_hdf - Series.to_sql - Series.to_msgpack - Series.to_json - Series.to_sparse - Series.to_dense - Series.to_string - Series.to_clipboard - Series.to_latex - -Sparse -~~~~~~ -.. autosummary:: - :toctree: generated/ - - SparseSeries.to_coo - SparseSeries.from_coo - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_attribute.rst - - Series.sparse.npoints - Series.sparse.density - Series.sparse.fill_value - Series.sparse.sp_values - - -.. autosummary:: - :toctree: generated/ - - Series.sparse.from_coo - Series.sparse.to_coo - -.. _api.dataframe: - -DataFrame ---------- - -Constructor -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame - -Attributes and underlying data -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**Axes** - -.. autosummary:: - :toctree: generated/ - - DataFrame.index - DataFrame.columns - -.. autosummary:: - :toctree: generated/ - - DataFrame.dtypes - DataFrame.ftypes - DataFrame.get_dtype_counts - DataFrame.get_ftype_counts - DataFrame.select_dtypes - DataFrame.values - DataFrame.get_values - DataFrame.axes - DataFrame.ndim - DataFrame.size - DataFrame.shape - DataFrame.memory_usage - DataFrame.empty - DataFrame.is_copy - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.astype - DataFrame.convert_objects - DataFrame.infer_objects - DataFrame.copy - DataFrame.isna - DataFrame.notna - DataFrame.bool - -Indexing, iteration -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.head - DataFrame.at - DataFrame.iat - DataFrame.loc - DataFrame.iloc - DataFrame.insert - DataFrame.__iter__ - DataFrame.items - DataFrame.keys - DataFrame.iteritems - DataFrame.iterrows - DataFrame.itertuples - DataFrame.lookup - DataFrame.pop - DataFrame.tail - DataFrame.xs - DataFrame.get - DataFrame.isin - DataFrame.where - DataFrame.mask - DataFrame.query - -For more information on ``.at``, ``.iat``, ``.loc``, and -``.iloc``, see the :ref:`indexing documentation `. - - -Binary operator functions -~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.add - DataFrame.sub - DataFrame.mul - DataFrame.div - DataFrame.truediv - DataFrame.floordiv - DataFrame.mod - DataFrame.pow - DataFrame.dot - DataFrame.radd - DataFrame.rsub - DataFrame.rmul - DataFrame.rdiv - DataFrame.rtruediv - DataFrame.rfloordiv - DataFrame.rmod - DataFrame.rpow - DataFrame.lt - DataFrame.gt - DataFrame.le - DataFrame.ge - DataFrame.ne - DataFrame.eq - DataFrame.combine - DataFrame.combine_first - -Function application, GroupBy & Window -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.apply - DataFrame.applymap - DataFrame.pipe - DataFrame.agg - DataFrame.aggregate - DataFrame.transform - DataFrame.groupby - DataFrame.rolling - DataFrame.expanding - DataFrame.ewm - -.. _api.dataframe.stats: - -Computations / Descriptive Stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.abs - DataFrame.all - DataFrame.any - DataFrame.clip - DataFrame.clip_lower - DataFrame.clip_upper - DataFrame.compound - DataFrame.corr - DataFrame.corrwith - DataFrame.count - DataFrame.cov - DataFrame.cummax - DataFrame.cummin - DataFrame.cumprod - DataFrame.cumsum - DataFrame.describe - DataFrame.diff - DataFrame.eval - DataFrame.kurt - DataFrame.kurtosis - DataFrame.mad - DataFrame.max - DataFrame.mean - DataFrame.median - DataFrame.min - DataFrame.mode - DataFrame.pct_change - DataFrame.prod - DataFrame.product - DataFrame.quantile - DataFrame.rank - DataFrame.round - DataFrame.sem - DataFrame.skew - DataFrame.sum - DataFrame.std - DataFrame.var - DataFrame.nunique - -Reindexing / Selection / Label manipulation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.add_prefix - DataFrame.add_suffix - DataFrame.align - DataFrame.at_time - DataFrame.between_time - DataFrame.drop - DataFrame.drop_duplicates - DataFrame.duplicated - DataFrame.equals - DataFrame.filter - DataFrame.first - DataFrame.head - DataFrame.idxmax - DataFrame.idxmin - DataFrame.last - DataFrame.reindex - DataFrame.reindex_axis - DataFrame.reindex_like - DataFrame.rename - DataFrame.rename_axis - DataFrame.reset_index - DataFrame.sample - DataFrame.select - DataFrame.set_axis - DataFrame.set_index - DataFrame.tail - DataFrame.take - DataFrame.truncate - -.. _api.dataframe.missing: - -Missing data handling -~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.dropna - DataFrame.fillna - DataFrame.replace - DataFrame.interpolate - -Reshaping, sorting, transposing -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.droplevel - DataFrame.pivot - DataFrame.pivot_table - DataFrame.reorder_levels - DataFrame.sort_values - DataFrame.sort_index - DataFrame.nlargest - DataFrame.nsmallest - DataFrame.swaplevel - DataFrame.stack - DataFrame.unstack - DataFrame.swapaxes - DataFrame.melt - DataFrame.squeeze - DataFrame.to_panel - DataFrame.to_xarray - DataFrame.T - DataFrame.transpose - -Combining / joining / merging -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.append - DataFrame.assign - DataFrame.join - DataFrame.merge - DataFrame.update - -Time series-related -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.asfreq - DataFrame.asof - DataFrame.shift - DataFrame.slice_shift - DataFrame.tshift - DataFrame.first_valid_index - DataFrame.last_valid_index - DataFrame.resample - DataFrame.to_period - DataFrame.to_timestamp - DataFrame.tz_convert - DataFrame.tz_localize - -.. _api.dataframe.plotting: - -Plotting -~~~~~~~~ - -``DataFrame.plot`` is both a callable method and a namespace attribute for -specific plotting methods of the form ``DataFrame.plot.``. - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_callable.rst - - DataFrame.plot - -.. autosummary:: - :toctree: generated/ - :template: autosummary/accessor_method.rst - - DataFrame.plot.area - DataFrame.plot.bar - DataFrame.plot.barh - DataFrame.plot.box - DataFrame.plot.density - DataFrame.plot.hexbin - DataFrame.plot.hist - DataFrame.plot.kde - DataFrame.plot.line - DataFrame.plot.pie - DataFrame.plot.scatter - -.. autosummary:: - :toctree: generated/ - - DataFrame.boxplot - DataFrame.hist - -Serialization / IO / Conversion -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DataFrame.from_csv - DataFrame.from_dict - DataFrame.from_items - DataFrame.from_records - DataFrame.info - DataFrame.to_parquet - DataFrame.to_pickle - DataFrame.to_csv - DataFrame.to_hdf - DataFrame.to_sql - DataFrame.to_dict - DataFrame.to_excel - DataFrame.to_json - DataFrame.to_html - DataFrame.to_feather - DataFrame.to_latex - DataFrame.to_stata - DataFrame.to_msgpack - DataFrame.to_gbq - DataFrame.to_records - DataFrame.to_sparse - DataFrame.to_dense - DataFrame.to_string - DataFrame.to_clipboard - DataFrame.style - -Sparse -~~~~~~ -.. autosummary:: - :toctree: generated/ - - SparseDataFrame.to_coo - -.. _api.panel: - -Panel ------- - -Constructor -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel - -Attributes and underlying data -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**Axes** - -* **items**: axis 0; each item corresponds to a DataFrame contained inside -* **major_axis**: axis 1; the index (rows) of each of the DataFrames -* **minor_axis**: axis 2; the columns of each of the DataFrames - -.. autosummary:: - :toctree: generated/ - - Panel.values - Panel.axes - Panel.ndim - Panel.size - Panel.shape - Panel.dtypes - Panel.ftypes - Panel.get_dtype_counts - Panel.get_ftype_counts - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.astype - Panel.copy - Panel.isna - Panel.notna - -Getting and setting -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.get_value - Panel.set_value - -Indexing, iteration, slicing -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.at - Panel.iat - Panel.loc - Panel.iloc - Panel.__iter__ - Panel.iteritems - Panel.pop - Panel.xs - Panel.major_xs - Panel.minor_xs - -For more information on ``.at``, ``.iat``, ``.loc``, and -``.iloc``, see the :ref:`indexing documentation `. - -Binary operator functions -~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.add - Panel.sub - Panel.mul - Panel.div - Panel.truediv - Panel.floordiv - Panel.mod - Panel.pow - Panel.radd - Panel.rsub - Panel.rmul - Panel.rdiv - Panel.rtruediv - Panel.rfloordiv - Panel.rmod - Panel.rpow - Panel.lt - Panel.gt - Panel.le - Panel.ge - Panel.ne - Panel.eq - -Function application, GroupBy -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.apply - Panel.groupby - -.. _api.panel.stats: - -Computations / Descriptive Stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.abs - Panel.clip - Panel.clip_lower - Panel.clip_upper - Panel.count - Panel.cummax - Panel.cummin - Panel.cumprod - Panel.cumsum - Panel.max - Panel.mean - Panel.median - Panel.min - Panel.pct_change - Panel.prod - Panel.sem - Panel.skew - Panel.sum - Panel.std - Panel.var - - -Reindexing / Selection / Label manipulation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.add_prefix - Panel.add_suffix - Panel.drop - Panel.equals - Panel.filter - Panel.first - Panel.last - Panel.reindex - Panel.reindex_axis - Panel.reindex_like - Panel.rename - Panel.sample - Panel.select - Panel.take - Panel.truncate - - -Missing data handling -~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.dropna - -Reshaping, sorting, transposing -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.sort_index - Panel.swaplevel - Panel.transpose - Panel.swapaxes - Panel.conform - -Combining / joining / merging -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.join - Panel.update - -Time series-related -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.asfreq - Panel.shift - Panel.resample - Panel.tz_convert - Panel.tz_localize - -Serialization / IO / Conversion -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Panel.from_dict - Panel.to_pickle - Panel.to_excel - Panel.to_hdf - Panel.to_sparse - Panel.to_frame - Panel.to_clipboard - -.. _api.index: - -Index ------ - -**Many of these methods or variants thereof are available on the objects -that contain an index (Series/DataFrame) and those should most likely be -used before calling these methods directly.** - -.. autosummary:: - :toctree: generated/ - - Index - -Attributes -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - Index.values - Index.is_monotonic - Index.is_monotonic_increasing - Index.is_monotonic_decreasing - Index.is_unique - Index.has_duplicates - Index.hasnans - Index.dtype - Index.dtype_str - Index.inferred_type - Index.is_all_dates - Index.shape - Index.name - Index.names - Index.nbytes - Index.ndim - Index.size - Index.empty - Index.strides - Index.itemsize - Index.base - Index.T - Index.memory_usage - -Modifying and Computations -~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.all - Index.any - Index.argmin - Index.argmax - Index.copy - Index.delete - Index.drop - Index.drop_duplicates - Index.duplicated - Index.equals - Index.factorize - Index.identical - Index.insert - Index.is_ - Index.is_boolean - Index.is_categorical - Index.is_floating - Index.is_integer - Index.is_interval - Index.is_mixed - Index.is_numeric - Index.is_object - Index.min - Index.max - Index.reindex - Index.rename - Index.repeat - Index.where - Index.take - Index.putmask - Index.unique - Index.nunique - Index.value_counts - -Compatibility with MultiIndex -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.set_names - Index.is_lexsorted_for_tuple - Index.droplevel - -Missing Values -~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.fillna - Index.dropna - Index.isna - Index.notna - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.astype - Index.item - Index.map - Index.ravel - Index.to_list - Index.to_native_types - Index.to_series - Index.to_frame - Index.view - -Sorting -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.argsort - Index.searchsorted - Index.sort_values - -Time-specific operations -~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.shift - -Combining / joining / set operations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.append - Index.join - Index.intersection - Index.union - Index.difference - Index.symmetric_difference - -Selecting -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Index.asof - Index.asof_locs - Index.contains - Index.get_duplicates - Index.get_indexer - Index.get_indexer_for - Index.get_indexer_non_unique - Index.get_level_values - Index.get_loc - Index.get_slice_bound - Index.get_value - Index.get_values - Index.set_value - Index.isin - Index.slice_indexer - Index.slice_locs - -.. _api.numericindex: - -Numeric Index -------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - RangeIndex - Int64Index - UInt64Index - Float64Index - -.. We need this autosummary so that the methods are generated. -.. Separate block, since they aren't classes. - -.. autosummary:: - :toctree: generated/ - - RangeIndex.from_range - - -.. _api.categoricalindex: - -CategoricalIndex ----------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - CategoricalIndex - -Categorical Components -~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - CategoricalIndex.codes - CategoricalIndex.categories - CategoricalIndex.ordered - CategoricalIndex.rename_categories - CategoricalIndex.reorder_categories - CategoricalIndex.add_categories - CategoricalIndex.remove_categories - CategoricalIndex.remove_unused_categories - CategoricalIndex.set_categories - CategoricalIndex.as_ordered - CategoricalIndex.as_unordered - -Modifying and Computations -~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CategoricalIndex.map - CategoricalIndex.equals - -.. _api.intervalindex: - -IntervalIndex -------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - IntervalIndex - -IntervalIndex Components -~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - IntervalIndex.from_arrays - IntervalIndex.from_tuples - IntervalIndex.from_breaks - IntervalIndex.contains - IntervalIndex.left - IntervalIndex.right - IntervalIndex.mid - IntervalIndex.closed - IntervalIndex.length - IntervalIndex.values - IntervalIndex.is_non_overlapping_monotonic - IntervalIndex.is_overlapping - IntervalIndex.get_loc - IntervalIndex.get_indexer - IntervalIndex.set_closed - IntervalIndex.overlaps - IntervalArray.to_tuples - - -.. _api.multiindex: - -MultiIndex ----------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - MultiIndex - -.. autosummary:: - :toctree: generated/ - - IndexSlice - -MultiIndex Constructors -~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - MultiIndex.from_arrays - MultiIndex.from_tuples - MultiIndex.from_product - MultiIndex.from_frame - -MultiIndex Attributes -~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - MultiIndex.names - MultiIndex.levels - MultiIndex.codes - MultiIndex.nlevels - MultiIndex.levshape - -MultiIndex Components -~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - MultiIndex.set_levels - MultiIndex.set_codes - MultiIndex.to_hierarchical - MultiIndex.to_flat_index - MultiIndex.to_frame - MultiIndex.is_lexsorted - MultiIndex.sortlevel - MultiIndex.droplevel - MultiIndex.swaplevel - MultiIndex.reorder_levels - MultiIndex.remove_unused_levels - -MultiIndex Selecting -~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - MultiIndex.get_loc - MultiIndex.get_loc_level - MultiIndex.get_indexer - MultiIndex.get_level_values - -.. _api.datetimeindex: - -DatetimeIndex -------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - DatetimeIndex - -Time/Date Components -~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - DatetimeIndex.year - DatetimeIndex.month - DatetimeIndex.day - DatetimeIndex.hour - DatetimeIndex.minute - DatetimeIndex.second - DatetimeIndex.microsecond - DatetimeIndex.nanosecond - DatetimeIndex.date - DatetimeIndex.time - DatetimeIndex.timetz - DatetimeIndex.dayofyear - DatetimeIndex.weekofyear - DatetimeIndex.week - DatetimeIndex.dayofweek - DatetimeIndex.weekday - DatetimeIndex.quarter - DatetimeIndex.tz - DatetimeIndex.freq - DatetimeIndex.freqstr - DatetimeIndex.is_month_start - DatetimeIndex.is_month_end - DatetimeIndex.is_quarter_start - DatetimeIndex.is_quarter_end - DatetimeIndex.is_year_start - DatetimeIndex.is_year_end - DatetimeIndex.is_leap_year - DatetimeIndex.inferred_freq - -Selecting -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DatetimeIndex.indexer_at_time - DatetimeIndex.indexer_between_time - - -Time-specific operations -~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DatetimeIndex.normalize - DatetimeIndex.strftime - DatetimeIndex.snap - DatetimeIndex.tz_convert - DatetimeIndex.tz_localize - DatetimeIndex.round - DatetimeIndex.floor - DatetimeIndex.ceil - DatetimeIndex.month_name - DatetimeIndex.day_name - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DatetimeIndex.to_period - DatetimeIndex.to_perioddelta - DatetimeIndex.to_pydatetime - DatetimeIndex.to_series - DatetimeIndex.to_frame - -TimedeltaIndex --------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - TimedeltaIndex - -Components -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - TimedeltaIndex.days - TimedeltaIndex.seconds - TimedeltaIndex.microseconds - TimedeltaIndex.nanoseconds - TimedeltaIndex.components - TimedeltaIndex.inferred_freq - -Conversion -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - TimedeltaIndex.to_pytimedelta - TimedeltaIndex.to_series - TimedeltaIndex.round - TimedeltaIndex.floor - TimedeltaIndex.ceil - TimedeltaIndex.to_frame - -.. currentmodule:: pandas - -PeriodIndex --------------- - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - PeriodIndex - -Attributes -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - PeriodIndex.day - PeriodIndex.dayofweek - PeriodIndex.dayofyear - PeriodIndex.days_in_month - PeriodIndex.daysinmonth - PeriodIndex.end_time - PeriodIndex.freq - PeriodIndex.freqstr - PeriodIndex.hour - PeriodIndex.is_leap_year - PeriodIndex.minute - PeriodIndex.month - PeriodIndex.quarter - PeriodIndex.qyear - PeriodIndex.second - PeriodIndex.start_time - PeriodIndex.week - PeriodIndex.weekday - PeriodIndex.weekofyear - PeriodIndex.year - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - PeriodIndex.asfreq - PeriodIndex.strftime - PeriodIndex.to_timestamp - -.. api.scalars: - -Scalars -------- - -Period -~~~~~~ -.. autosummary:: - :toctree: generated/ - - Period - -Attributes -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Period.day - Period.dayofweek - Period.dayofyear - Period.days_in_month - Period.daysinmonth - Period.end_time - Period.freq - Period.freqstr - Period.hour - Period.is_leap_year - Period.minute - Period.month - Period.ordinal - Period.quarter - Period.qyear - Period.second - Period.start_time - Period.week - Period.weekday - Period.weekofyear - Period.year - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Period.asfreq - Period.now - Period.strftime - Period.to_timestamp - -Timestamp -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timestamp - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timestamp.asm8 - Timestamp.day - Timestamp.dayofweek - Timestamp.dayofyear - Timestamp.days_in_month - Timestamp.daysinmonth - Timestamp.fold - Timestamp.hour - Timestamp.is_leap_year - Timestamp.is_month_end - Timestamp.is_month_start - Timestamp.is_quarter_end - Timestamp.is_quarter_start - Timestamp.is_year_end - Timestamp.is_year_start - Timestamp.max - Timestamp.microsecond - Timestamp.min - Timestamp.minute - Timestamp.month - Timestamp.nanosecond - Timestamp.quarter - Timestamp.resolution - Timestamp.second - Timestamp.tz - Timestamp.tzinfo - Timestamp.value - Timestamp.week - Timestamp.weekofyear - Timestamp.year - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timestamp.astimezone - Timestamp.ceil - Timestamp.combine - Timestamp.ctime - Timestamp.date - Timestamp.day_name - Timestamp.dst - Timestamp.floor - Timestamp.freq - Timestamp.freqstr - Timestamp.fromordinal - Timestamp.fromtimestamp - Timestamp.isocalendar - Timestamp.isoformat - Timestamp.isoweekday - Timestamp.month_name - Timestamp.normalize - Timestamp.now - Timestamp.replace - Timestamp.round - Timestamp.strftime - Timestamp.strptime - Timestamp.time - Timestamp.timestamp - Timestamp.timetuple - Timestamp.timetz - Timestamp.to_datetime64 - Timestamp.to_julian_date - Timestamp.to_period - Timestamp.to_pydatetime - Timestamp.today - Timestamp.toordinal - Timestamp.tz_convert - Timestamp.tz_localize - Timestamp.tzname - Timestamp.utcfromtimestamp - Timestamp.utcnow - Timestamp.utcoffset - Timestamp.utctimetuple - Timestamp.weekday - -Interval -~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Interval - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Interval.closed - Interval.closed_left - Interval.closed_right - Interval.left - Interval.length - Interval.mid - Interval.open_left - Interval.open_right - Interval.overlaps - Interval.right - -Timedelta -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timedelta - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timedelta.asm8 - Timedelta.components - Timedelta.days - Timedelta.delta - Timedelta.freq - Timedelta.is_populated - Timedelta.max - Timedelta.microseconds - Timedelta.min - Timedelta.nanoseconds - Timedelta.resolution - Timedelta.seconds - Timedelta.value - Timedelta.view - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Timedelta.ceil - Timedelta.floor - Timedelta.isoformat - Timedelta.round - Timedelta.to_pytimedelta - Timedelta.to_timedelta64 - Timedelta.total_seconds - -.. _api.dateoffsets: - -Date Offsets ------------- - -.. currentmodule:: pandas.tseries.offsets - -DateOffset -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DateOffset - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DateOffset.freqstr - DateOffset.kwds - DateOffset.name - DateOffset.nanos - DateOffset.normalize - DateOffset.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - DateOffset.apply - DateOffset.copy - DateOffset.isAnchored - DateOffset.onOffset - -BusinessDay -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessDay - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessDay.freqstr - BusinessDay.kwds - BusinessDay.name - BusinessDay.nanos - BusinessDay.normalize - BusinessDay.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessDay.apply - BusinessDay.apply_index - BusinessDay.copy - BusinessDay.isAnchored - BusinessDay.onOffset - -BusinessHour -~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessHour - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessHour.freqstr - BusinessHour.kwds - BusinessHour.name - BusinessHour.nanos - BusinessHour.normalize - BusinessHour.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessHour.apply - BusinessHour.copy - BusinessHour.isAnchored - BusinessHour.onOffset - -CustomBusinessDay -~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessDay - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessDay.freqstr - CustomBusinessDay.kwds - CustomBusinessDay.name - CustomBusinessDay.nanos - CustomBusinessDay.normalize - CustomBusinessDay.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessDay.apply - CustomBusinessDay.copy - CustomBusinessDay.isAnchored - CustomBusinessDay.onOffset - -CustomBusinessHour -~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessHour - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessHour.freqstr - CustomBusinessHour.kwds - CustomBusinessHour.name - CustomBusinessHour.nanos - CustomBusinessHour.normalize - CustomBusinessHour.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessHour.apply - CustomBusinessHour.copy - CustomBusinessHour.isAnchored - CustomBusinessHour.onOffset - -MonthOffset -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthOffset - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthOffset.freqstr - MonthOffset.kwds - MonthOffset.name - MonthOffset.nanos - MonthOffset.normalize - MonthOffset.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthOffset.apply - MonthOffset.apply_index - MonthOffset.copy - MonthOffset.isAnchored - MonthOffset.onOffset - -MonthEnd -~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthEnd.freqstr - MonthEnd.kwds - MonthEnd.name - MonthEnd.nanos - MonthEnd.normalize - MonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthEnd.apply - MonthEnd.apply_index - MonthEnd.copy - MonthEnd.isAnchored - MonthEnd.onOffset - -MonthBegin -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthBegin.freqstr - MonthBegin.kwds - MonthBegin.name - MonthBegin.nanos - MonthBegin.normalize - MonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - MonthBegin.apply - MonthBegin.apply_index - MonthBegin.copy - MonthBegin.isAnchored - MonthBegin.onOffset - -BusinessMonthEnd -~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthEnd.freqstr - BusinessMonthEnd.kwds - BusinessMonthEnd.name - BusinessMonthEnd.nanos - BusinessMonthEnd.normalize - BusinessMonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthEnd.apply - BusinessMonthEnd.apply_index - BusinessMonthEnd.copy - BusinessMonthEnd.isAnchored - BusinessMonthEnd.onOffset - -BusinessMonthBegin -~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthBegin.freqstr - BusinessMonthBegin.kwds - BusinessMonthBegin.name - BusinessMonthBegin.nanos - BusinessMonthBegin.normalize - BusinessMonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BusinessMonthBegin.apply - BusinessMonthBegin.apply_index - BusinessMonthBegin.copy - BusinessMonthBegin.isAnchored - BusinessMonthBegin.onOffset - -CustomBusinessMonthEnd -~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthEnd.freqstr - CustomBusinessMonthEnd.kwds - CustomBusinessMonthEnd.m_offset - CustomBusinessMonthEnd.name - CustomBusinessMonthEnd.nanos - CustomBusinessMonthEnd.normalize - CustomBusinessMonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthEnd.apply - CustomBusinessMonthEnd.copy - CustomBusinessMonthEnd.isAnchored - CustomBusinessMonthEnd.onOffset - -CustomBusinessMonthBegin -~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthBegin.freqstr - CustomBusinessMonthBegin.kwds - CustomBusinessMonthBegin.m_offset - CustomBusinessMonthBegin.name - CustomBusinessMonthBegin.nanos - CustomBusinessMonthBegin.normalize - CustomBusinessMonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CustomBusinessMonthBegin.apply - CustomBusinessMonthBegin.copy - CustomBusinessMonthBegin.isAnchored - CustomBusinessMonthBegin.onOffset - -SemiMonthOffset -~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthOffset - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthOffset.freqstr - SemiMonthOffset.kwds - SemiMonthOffset.name - SemiMonthOffset.nanos - SemiMonthOffset.normalize - SemiMonthOffset.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthOffset.apply - SemiMonthOffset.apply_index - SemiMonthOffset.copy - SemiMonthOffset.isAnchored - SemiMonthOffset.onOffset - -SemiMonthEnd -~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthEnd.freqstr - SemiMonthEnd.kwds - SemiMonthEnd.name - SemiMonthEnd.nanos - SemiMonthEnd.normalize - SemiMonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthEnd.apply - SemiMonthEnd.apply_index - SemiMonthEnd.copy - SemiMonthEnd.isAnchored - SemiMonthEnd.onOffset - -SemiMonthBegin -~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthBegin.freqstr - SemiMonthBegin.kwds - SemiMonthBegin.name - SemiMonthBegin.nanos - SemiMonthBegin.normalize - SemiMonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - SemiMonthBegin.apply - SemiMonthBegin.apply_index - SemiMonthBegin.copy - SemiMonthBegin.isAnchored - SemiMonthBegin.onOffset - -Week -~~~~ -.. autosummary:: - :toctree: generated/ - - Week - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Week.freqstr - Week.kwds - Week.name - Week.nanos - Week.normalize - Week.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Week.apply - Week.apply_index - Week.copy - Week.isAnchored - Week.onOffset - -WeekOfMonth -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - WeekOfMonth - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - WeekOfMonth.freqstr - WeekOfMonth.kwds - WeekOfMonth.name - WeekOfMonth.nanos - WeekOfMonth.normalize - WeekOfMonth.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - WeekOfMonth.apply - WeekOfMonth.copy - WeekOfMonth.isAnchored - WeekOfMonth.onOffset - -LastWeekOfMonth -~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - LastWeekOfMonth - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - LastWeekOfMonth.freqstr - LastWeekOfMonth.kwds - LastWeekOfMonth.name - LastWeekOfMonth.nanos - LastWeekOfMonth.normalize - LastWeekOfMonth.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - LastWeekOfMonth.apply - LastWeekOfMonth.copy - LastWeekOfMonth.isAnchored - LastWeekOfMonth.onOffset - -QuarterOffset -~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterOffset - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterOffset.freqstr - QuarterOffset.kwds - QuarterOffset.name - QuarterOffset.nanos - QuarterOffset.normalize - QuarterOffset.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterOffset.apply - QuarterOffset.apply_index - QuarterOffset.copy - QuarterOffset.isAnchored - QuarterOffset.onOffset - -BQuarterEnd -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterEnd.freqstr - BQuarterEnd.kwds - BQuarterEnd.name - BQuarterEnd.nanos - BQuarterEnd.normalize - BQuarterEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterEnd.apply - BQuarterEnd.apply_index - BQuarterEnd.copy - BQuarterEnd.isAnchored - BQuarterEnd.onOffset - -BQuarterBegin -~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterBegin.freqstr - BQuarterBegin.kwds - BQuarterBegin.name - BQuarterBegin.nanos - BQuarterBegin.normalize - BQuarterBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BQuarterBegin.apply - BQuarterBegin.apply_index - BQuarterBegin.copy - BQuarterBegin.isAnchored - BQuarterBegin.onOffset - -QuarterEnd -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterEnd.freqstr - QuarterEnd.kwds - QuarterEnd.name - QuarterEnd.nanos - QuarterEnd.normalize - QuarterEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterEnd.apply - QuarterEnd.apply_index - QuarterEnd.copy - QuarterEnd.isAnchored - QuarterEnd.onOffset - -QuarterBegin -~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterBegin.freqstr - QuarterBegin.kwds - QuarterBegin.name - QuarterBegin.nanos - QuarterBegin.normalize - QuarterBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - QuarterBegin.apply - QuarterBegin.apply_index - QuarterBegin.copy - QuarterBegin.isAnchored - QuarterBegin.onOffset - -YearOffset -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearOffset - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearOffset.freqstr - YearOffset.kwds - YearOffset.name - YearOffset.nanos - YearOffset.normalize - YearOffset.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearOffset.apply - YearOffset.apply_index - YearOffset.copy - YearOffset.isAnchored - YearOffset.onOffset - -BYearEnd -~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearEnd.freqstr - BYearEnd.kwds - BYearEnd.name - BYearEnd.nanos - BYearEnd.normalize - BYearEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearEnd.apply - BYearEnd.apply_index - BYearEnd.copy - BYearEnd.isAnchored - BYearEnd.onOffset - -BYearBegin -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearBegin.freqstr - BYearBegin.kwds - BYearBegin.name - BYearBegin.nanos - BYearBegin.normalize - BYearBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BYearBegin.apply - BYearBegin.apply_index - BYearBegin.copy - BYearBegin.isAnchored - BYearBegin.onOffset - -YearEnd -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearEnd.freqstr - YearEnd.kwds - YearEnd.name - YearEnd.nanos - YearEnd.normalize - YearEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearEnd.apply - YearEnd.apply_index - YearEnd.copy - YearEnd.isAnchored - YearEnd.onOffset - -YearBegin -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearBegin.freqstr - YearBegin.kwds - YearBegin.name - YearBegin.nanos - YearBegin.normalize - YearBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - YearBegin.apply - YearBegin.apply_index - YearBegin.copy - YearBegin.isAnchored - YearBegin.onOffset - -FY5253 -~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253 - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253.freqstr - FY5253.kwds - FY5253.name - FY5253.nanos - FY5253.normalize - FY5253.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253.apply - FY5253.copy - FY5253.get_rule_code_suffix - FY5253.get_year_end - FY5253.isAnchored - FY5253.onOffset - -FY5253Quarter -~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253Quarter - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253Quarter.freqstr - FY5253Quarter.kwds - FY5253Quarter.name - FY5253Quarter.nanos - FY5253Quarter.normalize - FY5253Quarter.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - FY5253Quarter.apply - FY5253Quarter.copy - FY5253Quarter.get_weeks - FY5253Quarter.isAnchored - FY5253Quarter.onOffset - FY5253Quarter.year_has_extra_week - -Easter -~~~~~~ -.. autosummary:: - :toctree: generated/ - - Easter - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Easter.freqstr - Easter.kwds - Easter.name - Easter.nanos - Easter.normalize - Easter.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Easter.apply - Easter.copy - Easter.isAnchored - Easter.onOffset - -Tick -~~~~ -.. autosummary:: - :toctree: generated/ - - Tick - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Tick.delta - Tick.freqstr - Tick.kwds - Tick.name - Tick.nanos - Tick.normalize - Tick.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Tick.copy - Tick.isAnchored - Tick.onOffset - -Day -~~~ -.. autosummary:: - :toctree: generated/ - - Day - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Day.delta - Day.freqstr - Day.kwds - Day.name - Day.nanos - Day.normalize - Day.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Day.copy - Day.isAnchored - Day.onOffset - -Hour -~~~~ -.. autosummary:: - :toctree: generated/ - - Hour - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Hour.delta - Hour.freqstr - Hour.kwds - Hour.name - Hour.nanos - Hour.normalize - Hour.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Hour.copy - Hour.isAnchored - Hour.onOffset - -Minute -~~~~~~ -.. autosummary:: - :toctree: generated/ - - Minute - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Minute.delta - Minute.freqstr - Minute.kwds - Minute.name - Minute.nanos - Minute.normalize - Minute.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Minute.copy - Minute.isAnchored - Minute.onOffset - -Second -~~~~~~ -.. autosummary:: - :toctree: generated/ - - Second - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Second.delta - Second.freqstr - Second.kwds - Second.name - Second.nanos - Second.normalize - Second.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Second.copy - Second.isAnchored - Second.onOffset - -Milli -~~~~~ -.. autosummary:: - :toctree: generated/ - - Milli - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Milli.delta - Milli.freqstr - Milli.kwds - Milli.name - Milli.nanos - Milli.normalize - Milli.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Milli.copy - Milli.isAnchored - Milli.onOffset - -Micro -~~~~~ -.. autosummary:: - :toctree: generated/ - - Micro - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Micro.delta - Micro.freqstr - Micro.kwds - Micro.name - Micro.nanos - Micro.normalize - Micro.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Micro.copy - Micro.isAnchored - Micro.onOffset - -Nano -~~~~ -.. autosummary:: - :toctree: generated/ - - Nano - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Nano.delta - Nano.freqstr - Nano.kwds - Nano.name - Nano.nanos - Nano.normalize - Nano.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Nano.copy - Nano.isAnchored - Nano.onOffset - -BDay -~~~~ -.. autosummary:: - :toctree: generated/ - - BDay - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BDay.base - BDay.freqstr - BDay.kwds - BDay.name - BDay.nanos - BDay.normalize - BDay.offset - BDay.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BDay.apply - BDay.apply_index - BDay.copy - BDay.isAnchored - BDay.onOffset - BDay.rollback - BDay.rollforward - -BMonthEnd -~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthEnd.base - BMonthEnd.freqstr - BMonthEnd.kwds - BMonthEnd.name - BMonthEnd.nanos - BMonthEnd.normalize - BMonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthEnd.apply - BMonthEnd.apply_index - BMonthEnd.copy - BMonthEnd.isAnchored - BMonthEnd.onOffset - BMonthEnd.rollback - BMonthEnd.rollforward - -BMonthBegin -~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthBegin.base - BMonthBegin.freqstr - BMonthBegin.kwds - BMonthBegin.name - BMonthBegin.nanos - BMonthBegin.normalize - BMonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - BMonthBegin.apply - BMonthBegin.apply_index - BMonthBegin.copy - BMonthBegin.isAnchored - BMonthBegin.onOffset - BMonthBegin.rollback - BMonthBegin.rollforward - -CBMonthEnd -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthEnd - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthEnd.base - CBMonthEnd.cbday_roll - CBMonthEnd.freqstr - CBMonthEnd.kwds - CBMonthEnd.m_offset - CBMonthEnd.month_roll - CBMonthEnd.name - CBMonthEnd.nanos - CBMonthEnd.normalize - CBMonthEnd.offset - CBMonthEnd.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthEnd.apply - CBMonthEnd.apply_index - CBMonthEnd.copy - CBMonthEnd.isAnchored - CBMonthEnd.onOffset - CBMonthEnd.rollback - CBMonthEnd.rollforward - -CBMonthBegin -~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthBegin - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthBegin.base - CBMonthBegin.cbday_roll - CBMonthBegin.freqstr - CBMonthBegin.kwds - CBMonthBegin.m_offset - CBMonthBegin.month_roll - CBMonthBegin.name - CBMonthBegin.nanos - CBMonthBegin.normalize - CBMonthBegin.offset - CBMonthBegin.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CBMonthBegin.apply - CBMonthBegin.apply_index - CBMonthBegin.copy - CBMonthBegin.isAnchored - CBMonthBegin.onOffset - CBMonthBegin.rollback - CBMonthBegin.rollforward - -CDay -~~~~ -.. autosummary:: - :toctree: generated/ - - CDay - -Properties -~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CDay.base - CDay.freqstr - CDay.kwds - CDay.name - CDay.nanos - CDay.normalize - CDay.offset - CDay.rule_code - -Methods -~~~~~~~ -.. autosummary:: - :toctree: generated/ - - CDay.apply - CDay.apply_index - CDay.copy - CDay.isAnchored - CDay.onOffset - CDay.rollback - CDay.rollforward - -.. _api.frequencies: - -Frequencies ------------ - -.. currentmodule:: pandas.tseries.frequencies - -.. _api.offsets: - -.. autosummary:: - :toctree: generated/ - - to_offset - - -Window ------- - -.. currentmodule:: pandas.core.window - -Rolling objects are returned by ``.rolling`` calls: :func:`pandas.DataFrame.rolling`, :func:`pandas.Series.rolling`, etc. -Expanding objects are returned by ``.expanding`` calls: :func:`pandas.DataFrame.expanding`, :func:`pandas.Series.expanding`, etc. -EWM objects are returned by ``.ewm`` calls: :func:`pandas.DataFrame.ewm`, :func:`pandas.Series.ewm`, etc. - -Standard moving window functions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. currentmodule:: pandas.core.window - -.. autosummary:: - :toctree: generated/ - - Rolling.count - Rolling.sum - Rolling.mean - Rolling.median - Rolling.var - Rolling.std - Rolling.min - Rolling.max - Rolling.corr - Rolling.cov - Rolling.skew - Rolling.kurt - Rolling.apply - Rolling.aggregate - Rolling.quantile - Window.mean - Window.sum - -.. _api.functions_expanding: - -Standard expanding window functions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. currentmodule:: pandas.core.window - -.. autosummary:: - :toctree: generated/ - - Expanding.count - Expanding.sum - Expanding.mean - Expanding.median - Expanding.var - Expanding.std - Expanding.min - Expanding.max - Expanding.corr - Expanding.cov - Expanding.skew - Expanding.kurt - Expanding.apply - Expanding.aggregate - Expanding.quantile - -Exponentially-weighted moving window functions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. currentmodule:: pandas.core.window - -.. autosummary:: - :toctree: generated/ - - EWM.mean - EWM.std - EWM.var - EWM.corr - EWM.cov - -GroupBy -------- -.. currentmodule:: pandas.core.groupby - -GroupBy objects are returned by groupby calls: :func:`pandas.DataFrame.groupby`, :func:`pandas.Series.groupby`, etc. - -Indexing, iteration -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - GroupBy.__iter__ - GroupBy.groups - GroupBy.indices - GroupBy.get_group - -.. currentmodule:: pandas - -.. autosummary:: - :toctree: generated/ - :template: autosummary/class_without_autosummary.rst - - Grouper - -.. currentmodule:: pandas.core.groupby - -Function application -~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - GroupBy.apply - GroupBy.agg - GroupBy.aggregate - GroupBy.transform - GroupBy.pipe - -Computations / Descriptive Stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - GroupBy.all - GroupBy.any - GroupBy.bfill - GroupBy.count - GroupBy.cumcount - GroupBy.ffill - GroupBy.first - GroupBy.head - GroupBy.last - GroupBy.max - GroupBy.mean - GroupBy.median - GroupBy.min - GroupBy.ngroup - GroupBy.nth - GroupBy.ohlc - GroupBy.prod - GroupBy.rank - GroupBy.pct_change - GroupBy.size - GroupBy.sem - GroupBy.std - GroupBy.sum - GroupBy.var - GroupBy.tail - -The following methods are available in both ``SeriesGroupBy`` and -``DataFrameGroupBy`` objects, but may differ slightly, usually in that -the ``DataFrameGroupBy`` version usually permits the specification of an -axis argument, and often an argument indicating whether to restrict -application to columns of a specific data type. - -.. autosummary:: - :toctree: generated/ - - DataFrameGroupBy.all - DataFrameGroupBy.any - DataFrameGroupBy.bfill - DataFrameGroupBy.corr - DataFrameGroupBy.count - DataFrameGroupBy.cov - DataFrameGroupBy.cummax - DataFrameGroupBy.cummin - DataFrameGroupBy.cumprod - DataFrameGroupBy.cumsum - DataFrameGroupBy.describe - DataFrameGroupBy.diff - DataFrameGroupBy.ffill - DataFrameGroupBy.fillna - DataFrameGroupBy.filter - DataFrameGroupBy.hist - DataFrameGroupBy.idxmax - DataFrameGroupBy.idxmin - DataFrameGroupBy.mad - DataFrameGroupBy.pct_change - DataFrameGroupBy.plot - DataFrameGroupBy.quantile - DataFrameGroupBy.rank - DataFrameGroupBy.resample - DataFrameGroupBy.shift - DataFrameGroupBy.size - DataFrameGroupBy.skew - DataFrameGroupBy.take - DataFrameGroupBy.tshift - -The following methods are available only for ``SeriesGroupBy`` objects. - -.. autosummary:: - :toctree: generated/ - - SeriesGroupBy.nlargest - SeriesGroupBy.nsmallest - SeriesGroupBy.nunique - SeriesGroupBy.unique - SeriesGroupBy.value_counts - SeriesGroupBy.is_monotonic_increasing - SeriesGroupBy.is_monotonic_decreasing - -The following methods are available only for ``DataFrameGroupBy`` objects. - -.. autosummary:: - :toctree: generated/ - - DataFrameGroupBy.corrwith - DataFrameGroupBy.boxplot - -Resampling ----------- -.. currentmodule:: pandas.core.resample - -Resampler objects are returned by resample calls: :func:`pandas.DataFrame.resample`, :func:`pandas.Series.resample`. - -Indexing, iteration -~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Resampler.__iter__ - Resampler.groups - Resampler.indices - Resampler.get_group - -Function application -~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Resampler.apply - Resampler.aggregate - Resampler.transform - Resampler.pipe - -Upsampling -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - Resampler.ffill - Resampler.backfill - Resampler.bfill - Resampler.pad - Resampler.nearest - Resampler.fillna - Resampler.asfreq - Resampler.interpolate - -Computations / Descriptive Stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Resampler.count - Resampler.nunique - Resampler.first - Resampler.last - Resampler.max - Resampler.mean - Resampler.median - Resampler.min - Resampler.ohlc - Resampler.prod - Resampler.size - Resampler.sem - Resampler.std - Resampler.sum - Resampler.var - Resampler.quantile - -Style ------ -.. currentmodule:: pandas.io.formats.style - -``Styler`` objects are returned by :attr:`pandas.DataFrame.style`. - -Styler Constructor -~~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Styler - Styler.from_custom_template - - -Styler Attributes -~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Styler.env - Styler.template - Styler.loader - -Style Application -~~~~~~~~~~~~~~~~~ -.. autosummary:: - :toctree: generated/ - - Styler.apply - Styler.applymap - Styler.where - Styler.format - Styler.set_precision - Styler.set_table_styles - Styler.set_table_attributes - Styler.set_caption - Styler.set_properties - Styler.set_uuid - Styler.clear - Styler.pipe - -Builtin Styles -~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - Styler.highlight_max - Styler.highlight_min - Styler.highlight_null - Styler.background_gradient - Styler.bar - -Style Export and Import -~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - Styler.render - Styler.export - Styler.use - Styler.to_excel - -Plotting --------- - -.. currentmodule:: pandas.plotting - -The following functions are contained in the `pandas.plotting` module. - -.. autosummary:: - :toctree: generated/ - - andrews_curves - bootstrap_plot - deregister_matplotlib_converters - lag_plot - parallel_coordinates - radviz - register_matplotlib_converters - scatter_matrix - -.. currentmodule:: pandas - -General utility functions -------------------------- - -Working with options -~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - describe_option - reset_option - get_option - set_option - option_context - -Testing functions -~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - testing.assert_frame_equal - testing.assert_series_equal - testing.assert_index_equal - - -Exceptions and warnings -~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - errors.DtypeWarning - errors.EmptyDataError - errors.OutOfBoundsDatetime - errors.ParserError - errors.ParserWarning - errors.PerformanceWarning - errors.UnsortedIndexError - errors.UnsupportedFunctionCall - - -Data types related functionality -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - api.types.union_categoricals - api.types.infer_dtype - api.types.pandas_dtype - -Dtype introspection - -.. autosummary:: - :toctree: generated/ - - api.types.is_bool_dtype - api.types.is_categorical_dtype - api.types.is_complex_dtype - api.types.is_datetime64_any_dtype - api.types.is_datetime64_dtype - api.types.is_datetime64_ns_dtype - api.types.is_datetime64tz_dtype - api.types.is_extension_type - api.types.is_float_dtype - api.types.is_int64_dtype - api.types.is_integer_dtype - api.types.is_interval_dtype - api.types.is_numeric_dtype - api.types.is_object_dtype - api.types.is_period_dtype - api.types.is_signed_integer_dtype - api.types.is_string_dtype - api.types.is_timedelta64_dtype - api.types.is_timedelta64_ns_dtype - api.types.is_unsigned_integer_dtype - api.types.is_sparse - -Iterable introspection - -.. autosummary:: - :toctree: generated/ - - api.types.is_dict_like - api.types.is_file_like - api.types.is_list_like - api.types.is_named_tuple - api.types.is_iterator - -Scalar introspection - -.. autosummary:: - :toctree: generated/ - - api.types.is_bool - api.types.is_categorical - api.types.is_complex - api.types.is_datetimetz - api.types.is_float - api.types.is_hashable - api.types.is_integer - api.types.is_interval - api.types.is_number - api.types.is_period - api.types.is_re - api.types.is_re_compilable - api.types.is_scalar - -Extensions ----------- - -These are primarily intended for library authors looking to extend pandas -objects. - -.. currentmodule:: pandas - -.. autosummary:: - :toctree: generated/ - - api.extensions.register_extension_dtype - api.extensions.register_dataframe_accessor - api.extensions.register_series_accessor - api.extensions.register_index_accessor - api.extensions.ExtensionDtype - api.extensions.ExtensionArray - arrays.PandasArray - -.. This is to prevent warnings in the doc build. We don't want to encourage -.. these methods. - -.. toctree:: - :hidden: - - generated/pandas.DataFrame.blocks - generated/pandas.DataFrame.as_matrix - generated/pandas.DataFrame.ix - generated/pandas.Index.asi8 - generated/pandas.Index.data - generated/pandas.Index.flags - generated/pandas.Index.holds_integer - generated/pandas.Index.is_type_compatible - generated/pandas.Index.nlevels - generated/pandas.Index.sort - generated/pandas.Panel.agg - generated/pandas.Panel.aggregate - generated/pandas.Panel.blocks - generated/pandas.Panel.empty - generated/pandas.Panel.is_copy - generated/pandas.Panel.items - generated/pandas.Panel.ix - generated/pandas.Panel.major_axis - generated/pandas.Panel.minor_axis - generated/pandas.Series.asobject - generated/pandas.Series.blocks - generated/pandas.Series.from_array - generated/pandas.Series.ix - generated/pandas.Series.imag - generated/pandas.Series.real - - -.. Can't convince sphinx to generate toctree for this class attribute. -.. So we do it manually to avoid a warning - -.. toctree:: - :hidden: - - generated/pandas.api.extensions.ExtensionDtype.na_value diff --git a/doc/source/api/extensions.rst b/doc/source/api/extensions.rst new file mode 100644 index 00000000000000..6ea2738b454aae --- /dev/null +++ b/doc/source/api/extensions.rst @@ -0,0 +1,21 @@ +{{ header }} + +.. _api.extensions: + +Extensions +---------- +.. currentmodule:: pandas + +These are primarily intended for library authors looking to extend pandas +objects. + +.. autosummary:: + :toctree: generated/ + + api.extensions.register_extension_dtype + api.extensions.register_dataframe_accessor + api.extensions.register_series_accessor + api.extensions.register_index_accessor + api.extensions.ExtensionDtype + api.extensions.ExtensionArray + arrays.PandasArray diff --git a/doc/source/api/frame.rst b/doc/source/api/frame.rst new file mode 100644 index 00000000000000..20221a52b95f30 --- /dev/null +++ b/doc/source/api/frame.rst @@ -0,0 +1,350 @@ +{{ header }} + +.. _api.dataframe: + +DataFrame +--------- +.. currentmodule:: pandas + +Constructor +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame + +Attributes and underlying data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**Axes** + +.. autosummary:: + :toctree: generated/ + + DataFrame.index + DataFrame.columns + +.. autosummary:: + :toctree: generated/ + + DataFrame.dtypes + DataFrame.ftypes + DataFrame.get_dtype_counts + DataFrame.get_ftype_counts + DataFrame.select_dtypes + DataFrame.values + DataFrame.get_values + DataFrame.axes + DataFrame.ndim + DataFrame.size + DataFrame.shape + DataFrame.memory_usage + DataFrame.empty + DataFrame.is_copy + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.astype + DataFrame.convert_objects + DataFrame.infer_objects + DataFrame.copy + DataFrame.isna + DataFrame.notna + DataFrame.bool + +Indexing, iteration +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.head + DataFrame.at + DataFrame.iat + DataFrame.loc + DataFrame.iloc + DataFrame.insert + DataFrame.__iter__ + DataFrame.items + DataFrame.keys + DataFrame.iteritems + DataFrame.iterrows + DataFrame.itertuples + DataFrame.lookup + DataFrame.pop + DataFrame.tail + DataFrame.xs + DataFrame.get + DataFrame.isin + DataFrame.where + DataFrame.mask + DataFrame.query + +For more information on ``.at``, ``.iat``, ``.loc``, and +``.iloc``, see the :ref:`indexing documentation `. + +Binary operator functions +~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.add + DataFrame.sub + DataFrame.mul + DataFrame.div + DataFrame.truediv + DataFrame.floordiv + DataFrame.mod + DataFrame.pow + DataFrame.dot + DataFrame.radd + DataFrame.rsub + DataFrame.rmul + DataFrame.rdiv + DataFrame.rtruediv + DataFrame.rfloordiv + DataFrame.rmod + DataFrame.rpow + DataFrame.lt + DataFrame.gt + DataFrame.le + DataFrame.ge + DataFrame.ne + DataFrame.eq + DataFrame.combine + DataFrame.combine_first + +Function application, GroupBy & Window +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.apply + DataFrame.applymap + DataFrame.pipe + DataFrame.agg + DataFrame.aggregate + DataFrame.transform + DataFrame.groupby + DataFrame.rolling + DataFrame.expanding + DataFrame.ewm + +.. _api.dataframe.stats: + +Computations / Descriptive Stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.abs + DataFrame.all + DataFrame.any + DataFrame.clip + DataFrame.clip_lower + DataFrame.clip_upper + DataFrame.compound + DataFrame.corr + DataFrame.corrwith + DataFrame.count + DataFrame.cov + DataFrame.cummax + DataFrame.cummin + DataFrame.cumprod + DataFrame.cumsum + DataFrame.describe + DataFrame.diff + DataFrame.eval + DataFrame.kurt + DataFrame.kurtosis + DataFrame.mad + DataFrame.max + DataFrame.mean + DataFrame.median + DataFrame.min + DataFrame.mode + DataFrame.pct_change + DataFrame.prod + DataFrame.product + DataFrame.quantile + DataFrame.rank + DataFrame.round + DataFrame.sem + DataFrame.skew + DataFrame.sum + DataFrame.std + DataFrame.var + DataFrame.nunique + +Reindexing / Selection / Label manipulation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.add_prefix + DataFrame.add_suffix + DataFrame.align + DataFrame.at_time + DataFrame.between_time + DataFrame.drop + DataFrame.drop_duplicates + DataFrame.duplicated + DataFrame.equals + DataFrame.filter + DataFrame.first + DataFrame.head + DataFrame.idxmax + DataFrame.idxmin + DataFrame.last + DataFrame.reindex + DataFrame.reindex_axis + DataFrame.reindex_like + DataFrame.rename + DataFrame.rename_axis + DataFrame.reset_index + DataFrame.sample + DataFrame.select + DataFrame.set_axis + DataFrame.set_index + DataFrame.tail + DataFrame.take + DataFrame.truncate + +.. _api.dataframe.missing: + +Missing data handling +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.dropna + DataFrame.fillna + DataFrame.replace + DataFrame.interpolate + +Reshaping, sorting, transposing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.droplevel + DataFrame.pivot + DataFrame.pivot_table + DataFrame.reorder_levels + DataFrame.sort_values + DataFrame.sort_index + DataFrame.nlargest + DataFrame.nsmallest + DataFrame.swaplevel + DataFrame.stack + DataFrame.unstack + DataFrame.swapaxes + DataFrame.melt + DataFrame.squeeze + DataFrame.to_panel + DataFrame.to_xarray + DataFrame.T + DataFrame.transpose + +Combining / joining / merging +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.append + DataFrame.assign + DataFrame.join + DataFrame.merge + DataFrame.update + +Time series-related +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.asfreq + DataFrame.asof + DataFrame.shift + DataFrame.slice_shift + DataFrame.tshift + DataFrame.first_valid_index + DataFrame.last_valid_index + DataFrame.resample + DataFrame.to_period + DataFrame.to_timestamp + DataFrame.tz_convert + DataFrame.tz_localize + +.. _api.dataframe.plotting: + +Plotting +~~~~~~~~ +``DataFrame.plot`` is both a callable method and a namespace attribute for +specific plotting methods of the form ``DataFrame.plot.``. + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_callable.rst + + DataFrame.plot + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + DataFrame.plot.area + DataFrame.plot.bar + DataFrame.plot.barh + DataFrame.plot.box + DataFrame.plot.density + DataFrame.plot.hexbin + DataFrame.plot.hist + DataFrame.plot.kde + DataFrame.plot.line + DataFrame.plot.pie + DataFrame.plot.scatter + +.. autosummary:: + :toctree: generated/ + + DataFrame.boxplot + DataFrame.hist + +Serialization / IO / Conversion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DataFrame.from_csv + DataFrame.from_dict + DataFrame.from_items + DataFrame.from_records + DataFrame.info + DataFrame.to_parquet + DataFrame.to_pickle + DataFrame.to_csv + DataFrame.to_hdf + DataFrame.to_sql + DataFrame.to_dict + DataFrame.to_excel + DataFrame.to_json + DataFrame.to_html + DataFrame.to_feather + DataFrame.to_latex + DataFrame.to_stata + DataFrame.to_msgpack + DataFrame.to_gbq + DataFrame.to_records + DataFrame.to_sparse + DataFrame.to_dense + DataFrame.to_string + DataFrame.to_clipboard + DataFrame.style + +Sparse +~~~~~~ +.. autosummary:: + :toctree: generated/ + + SparseDataFrame.to_coo diff --git a/doc/source/api/general_functions.rst b/doc/source/api/general_functions.rst new file mode 100644 index 00000000000000..297818844395b5 --- /dev/null +++ b/doc/source/api/general_functions.rst @@ -0,0 +1,86 @@ +{{ header }} + +.. _api.general_functions: + +General functions +----------------- +.. currentmodule:: pandas + +Data manipulations +~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + melt + pivot + pivot_table + crosstab + cut + qcut + merge + merge_ordered + merge_asof + concat + get_dummies + factorize + unique + wide_to_long + +Top-level missing data +~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + isna + isnull + notna + notnull + +Top-level conversions +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + to_numeric + +Top-level dealing with datetimelike +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + to_datetime + to_timedelta + date_range + bdate_range + period_range + timedelta_range + infer_freq + +Top-level dealing with intervals +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + interval_range + +Top-level evaluation +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + eval + +Hashing +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + util.hash_array + util.hash_pandas_object + +Testing +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + test diff --git a/doc/source/api/general_utility_functions.rst b/doc/source/api/general_utility_functions.rst new file mode 100644 index 00000000000000..0d392ef5083908 --- /dev/null +++ b/doc/source/api/general_utility_functions.rst @@ -0,0 +1,107 @@ +{{ header }} + +.. _api.general_utility_functions: + +General utility functions +------------------------- +.. currentmodule:: pandas + +Working with options +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + describe_option + reset_option + get_option + set_option + option_context + +Testing functions +~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + testing.assert_frame_equal + testing.assert_series_equal + testing.assert_index_equal + +Exceptions and warnings +~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + errors.DtypeWarning + errors.EmptyDataError + errors.OutOfBoundsDatetime + errors.ParserError + errors.ParserWarning + errors.PerformanceWarning + errors.UnsortedIndexError + errors.UnsupportedFunctionCall + +Data types related functionality +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + api.types.union_categoricals + api.types.infer_dtype + api.types.pandas_dtype + +Dtype introspection + +.. autosummary:: + :toctree: generated/ + + api.types.is_bool_dtype + api.types.is_categorical_dtype + api.types.is_complex_dtype + api.types.is_datetime64_any_dtype + api.types.is_datetime64_dtype + api.types.is_datetime64_ns_dtype + api.types.is_datetime64tz_dtype + api.types.is_extension_type + api.types.is_float_dtype + api.types.is_int64_dtype + api.types.is_integer_dtype + api.types.is_interval_dtype + api.types.is_numeric_dtype + api.types.is_object_dtype + api.types.is_period_dtype + api.types.is_signed_integer_dtype + api.types.is_string_dtype + api.types.is_timedelta64_dtype + api.types.is_timedelta64_ns_dtype + api.types.is_unsigned_integer_dtype + api.types.is_sparse + +Iterable introspection + +.. autosummary:: + :toctree: generated/ + + api.types.is_dict_like + api.types.is_file_like + api.types.is_list_like + api.types.is_named_tuple + api.types.is_iterator + +Scalar introspection + +.. autosummary:: + :toctree: generated/ + + api.types.is_bool + api.types.is_categorical + api.types.is_complex + api.types.is_datetimetz + api.types.is_float + api.types.is_hashable + api.types.is_integer + api.types.is_interval + api.types.is_number + api.types.is_period + api.types.is_re + api.types.is_re_compilable + api.types.is_scalar diff --git a/doc/source/api/groupby.rst b/doc/source/api/groupby.rst new file mode 100644 index 00000000000000..65cb4791143f9a --- /dev/null +++ b/doc/source/api/groupby.rst @@ -0,0 +1,131 @@ +{{ header }} + +.. _api.groupby: + +GroupBy +------- +.. currentmodule:: pandas.core.groupby + +GroupBy objects are returned by groupby calls: :func:`pandas.DataFrame.groupby`, :func:`pandas.Series.groupby`, etc. + +Indexing, iteration +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + GroupBy.__iter__ + GroupBy.groups + GroupBy.indices + GroupBy.get_group + +.. currentmodule:: pandas + +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + Grouper + +.. currentmodule:: pandas.core.groupby + +Function application +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + GroupBy.apply + GroupBy.agg + GroupBy.aggregate + GroupBy.transform + GroupBy.pipe + +Computations / Descriptive Stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + GroupBy.all + GroupBy.any + GroupBy.bfill + GroupBy.count + GroupBy.cumcount + GroupBy.ffill + GroupBy.first + GroupBy.head + GroupBy.last + GroupBy.max + GroupBy.mean + GroupBy.median + GroupBy.min + GroupBy.ngroup + GroupBy.nth + GroupBy.ohlc + GroupBy.prod + GroupBy.rank + GroupBy.pct_change + GroupBy.size + GroupBy.sem + GroupBy.std + GroupBy.sum + GroupBy.var + GroupBy.tail + +The following methods are available in both ``SeriesGroupBy`` and +``DataFrameGroupBy`` objects, but may differ slightly, usually in that +the ``DataFrameGroupBy`` version usually permits the specification of an +axis argument, and often an argument indicating whether to restrict +application to columns of a specific data type. + +.. autosummary:: + :toctree: generated/ + + DataFrameGroupBy.all + DataFrameGroupBy.any + DataFrameGroupBy.bfill + DataFrameGroupBy.corr + DataFrameGroupBy.count + DataFrameGroupBy.cov + DataFrameGroupBy.cummax + DataFrameGroupBy.cummin + DataFrameGroupBy.cumprod + DataFrameGroupBy.cumsum + DataFrameGroupBy.describe + DataFrameGroupBy.diff + DataFrameGroupBy.ffill + DataFrameGroupBy.fillna + DataFrameGroupBy.filter + DataFrameGroupBy.hist + DataFrameGroupBy.idxmax + DataFrameGroupBy.idxmin + DataFrameGroupBy.mad + DataFrameGroupBy.pct_change + DataFrameGroupBy.plot + DataFrameGroupBy.quantile + DataFrameGroupBy.rank + DataFrameGroupBy.resample + DataFrameGroupBy.shift + DataFrameGroupBy.size + DataFrameGroupBy.skew + DataFrameGroupBy.take + DataFrameGroupBy.tshift + +The following methods are available only for ``SeriesGroupBy`` objects. + +.. autosummary:: + :toctree: generated/ + + SeriesGroupBy.nlargest + SeriesGroupBy.nsmallest + SeriesGroupBy.nunique + SeriesGroupBy.unique + SeriesGroupBy.value_counts + SeriesGroupBy.is_monotonic_increasing + SeriesGroupBy.is_monotonic_decreasing + +The following methods are available only for ``DataFrameGroupBy`` objects. + +.. autosummary:: + :toctree: generated/ + + DataFrameGroupBy.corrwith + DataFrameGroupBy.boxplot diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst new file mode 100644 index 00000000000000..37cca7fc37eecf --- /dev/null +++ b/doc/source/api/index.rst @@ -0,0 +1,80 @@ +{{ header }} + +.. _api: + +************* +API Reference +************* + +This page gives an overview of all public pandas objects, functions and +methods. All classes and functions exposed in ``pandas.*`` namespace are public. + +Some subpackages are public which include ``pandas.errors``, +``pandas.plotting``, and ``pandas.testing``. Public functions in +``pandas.io`` and ``pandas.tseries`` submodules are mentioned in +the documentation. ``pandas.api.types`` subpackage holds some +public functions related to data types in pandas. + +.. warning:: + + The ``pandas.core``, ``pandas.compat``, and ``pandas.util`` top-level modules are PRIVATE. Stable functionality in such modules is not guaranteed. + +.. toctree:: + :maxdepth: 2 + + io + general_functions + series + frame + panel + indices + scalars + offset_frequency + window + groupby + resampling + style + plotting + general_utility_functions + extensions + +.. This is to prevent warnings in the doc build. We don't want to encourage +.. these methods. + +.. toctree:: + :hidden: + + generated/pandas.DataFrame.blocks + generated/pandas.DataFrame.as_matrix + generated/pandas.DataFrame.ix + generated/pandas.Index.asi8 + generated/pandas.Index.data + generated/pandas.Index.flags + generated/pandas.Index.holds_integer + generated/pandas.Index.is_type_compatible + generated/pandas.Index.nlevels + generated/pandas.Index.sort + generated/pandas.Panel.agg + generated/pandas.Panel.aggregate + generated/pandas.Panel.blocks + generated/pandas.Panel.empty + generated/pandas.Panel.is_copy + generated/pandas.Panel.items + generated/pandas.Panel.ix + generated/pandas.Panel.major_axis + generated/pandas.Panel.minor_axis + generated/pandas.Series.asobject + generated/pandas.Series.blocks + generated/pandas.Series.from_array + generated/pandas.Series.ix + generated/pandas.Series.imag + generated/pandas.Series.real + + +.. Can't convince sphinx to generate toctree for this class attribute. +.. So we do it manually to avoid a warning + +.. toctree:: + :hidden: + + generated/pandas.api.extensions.ExtensionDtype.na_value diff --git a/doc/source/api/indices.rst b/doc/source/api/indices.rst new file mode 100644 index 00000000000000..31e7b3650ddef9 --- /dev/null +++ b/doc/source/api/indices.rst @@ -0,0 +1,476 @@ +{{ header }} + +.. _api.index: + +Index +----- +.. currentmodule:: pandas + +**Many of these methods or variants thereof are available on the objects +that contain an index (Series/DataFrame) and those should most likely be +used before calling these methods directly.** + +.. autosummary:: + :toctree: generated/ + + Index + +Attributes +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.values + Index.is_monotonic + Index.is_monotonic_increasing + Index.is_monotonic_decreasing + Index.is_unique + Index.has_duplicates + Index.hasnans + Index.dtype + Index.dtype_str + Index.inferred_type + Index.is_all_dates + Index.shape + Index.name + Index.names + Index.nbytes + Index.ndim + Index.size + Index.empty + Index.strides + Index.itemsize + Index.base + Index.T + Index.memory_usage + +Modifying and Computations +~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.all + Index.any + Index.argmin + Index.argmax + Index.copy + Index.delete + Index.drop + Index.drop_duplicates + Index.duplicated + Index.equals + Index.factorize + Index.identical + Index.insert + Index.is_ + Index.is_boolean + Index.is_categorical + Index.is_floating + Index.is_integer + Index.is_interval + Index.is_mixed + Index.is_numeric + Index.is_object + Index.min + Index.max + Index.reindex + Index.rename + Index.repeat + Index.where + Index.take + Index.putmask + Index.unique + Index.nunique + Index.value_counts + +Compatibility with MultiIndex +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.set_names + Index.is_lexsorted_for_tuple + Index.droplevel + +Missing Values +~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.fillna + Index.dropna + Index.isna + Index.notna + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.astype + Index.item + Index.map + Index.ravel + Index.to_list + Index.to_native_types + Index.to_series + Index.to_frame + Index.view + +Sorting +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.argsort + Index.searchsorted + Index.sort_values + +Time-specific operations +~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.shift + +Combining / joining / set operations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.append + Index.join + Index.intersection + Index.union + Index.difference + Index.symmetric_difference + +Selecting +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Index.asof + Index.asof_locs + Index.contains + Index.get_duplicates + Index.get_indexer + Index.get_indexer_for + Index.get_indexer_non_unique + Index.get_level_values + Index.get_loc + Index.get_slice_bound + Index.get_value + Index.get_values + Index.set_value + Index.isin + Index.slice_indexer + Index.slice_locs + +.. _api.numericindex: + +Numeric Index +------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + RangeIndex + Int64Index + UInt64Index + Float64Index + +.. We need this autosummary so that the methods are generated. +.. Separate block, since they aren't classes. + +.. autosummary:: + :toctree: generated/ + + RangeIndex.from_range + +.. _api.categoricalindex: + +CategoricalIndex +---------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + CategoricalIndex + +Categorical Components +~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CategoricalIndex.codes + CategoricalIndex.categories + CategoricalIndex.ordered + CategoricalIndex.rename_categories + CategoricalIndex.reorder_categories + CategoricalIndex.add_categories + CategoricalIndex.remove_categories + CategoricalIndex.remove_unused_categories + CategoricalIndex.set_categories + CategoricalIndex.as_ordered + CategoricalIndex.as_unordered + +Modifying and Computations +~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CategoricalIndex.map + CategoricalIndex.equals + +.. _api.intervalindex: + +IntervalIndex +------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + IntervalIndex + +IntervalIndex Components +~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + IntervalIndex.from_arrays + IntervalIndex.from_tuples + IntervalIndex.from_breaks + IntervalIndex.contains + IntervalIndex.left + IntervalIndex.right + IntervalIndex.mid + IntervalIndex.closed + IntervalIndex.length + IntervalIndex.values + IntervalIndex.is_non_overlapping_monotonic + IntervalIndex.is_overlapping + IntervalIndex.get_loc + IntervalIndex.get_indexer + IntervalIndex.set_closed + IntervalIndex.overlaps + +.. _api.multiindex: + +MultiIndex +---------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + MultiIndex + +.. autosummary:: + :toctree: generated/ + + IndexSlice + +MultiIndex Constructors +~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MultiIndex.from_arrays + MultiIndex.from_tuples + MultiIndex.from_product + MultiIndex.from_frame + +MultiIndex Attributes +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MultiIndex.names + MultiIndex.levels + MultiIndex.codes + MultiIndex.nlevels + MultiIndex.levshape + +MultiIndex Components +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MultiIndex.set_levels + MultiIndex.set_codes + MultiIndex.to_hierarchical + MultiIndex.to_flat_index + MultiIndex.to_frame + MultiIndex.is_lexsorted + MultiIndex.sortlevel + MultiIndex.droplevel + MultiIndex.swaplevel + MultiIndex.reorder_levels + MultiIndex.remove_unused_levels + +MultiIndex Selecting +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MultiIndex.get_loc + MultiIndex.get_loc_level + MultiIndex.get_indexer + MultiIndex.get_level_values + +.. _api.datetimeindex: + +DatetimeIndex +------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + DatetimeIndex + +Time/Date Components +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DatetimeIndex.year + DatetimeIndex.month + DatetimeIndex.day + DatetimeIndex.hour + DatetimeIndex.minute + DatetimeIndex.second + DatetimeIndex.microsecond + DatetimeIndex.nanosecond + DatetimeIndex.date + DatetimeIndex.time + DatetimeIndex.timetz + DatetimeIndex.dayofyear + DatetimeIndex.weekofyear + DatetimeIndex.week + DatetimeIndex.dayofweek + DatetimeIndex.weekday + DatetimeIndex.quarter + DatetimeIndex.tz + DatetimeIndex.freq + DatetimeIndex.freqstr + DatetimeIndex.is_month_start + DatetimeIndex.is_month_end + DatetimeIndex.is_quarter_start + DatetimeIndex.is_quarter_end + DatetimeIndex.is_year_start + DatetimeIndex.is_year_end + DatetimeIndex.is_leap_year + DatetimeIndex.inferred_freq + +Selecting +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DatetimeIndex.indexer_at_time + DatetimeIndex.indexer_between_time + + +Time-specific operations +~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DatetimeIndex.normalize + DatetimeIndex.strftime + DatetimeIndex.snap + DatetimeIndex.tz_convert + DatetimeIndex.tz_localize + DatetimeIndex.round + DatetimeIndex.floor + DatetimeIndex.ceil + DatetimeIndex.month_name + DatetimeIndex.day_name + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DatetimeIndex.to_period + DatetimeIndex.to_perioddelta + DatetimeIndex.to_pydatetime + DatetimeIndex.to_series + DatetimeIndex.to_frame + +TimedeltaIndex +-------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + TimedeltaIndex + +Components +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + TimedeltaIndex.days + TimedeltaIndex.seconds + TimedeltaIndex.microseconds + TimedeltaIndex.nanoseconds + TimedeltaIndex.components + TimedeltaIndex.inferred_freq + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + TimedeltaIndex.to_pytimedelta + TimedeltaIndex.to_series + TimedeltaIndex.round + TimedeltaIndex.floor + TimedeltaIndex.ceil + TimedeltaIndex.to_frame + +.. currentmodule:: pandas + +PeriodIndex +-------------- +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + PeriodIndex + +Attributes +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + PeriodIndex.day + PeriodIndex.dayofweek + PeriodIndex.dayofyear + PeriodIndex.days_in_month + PeriodIndex.daysinmonth + PeriodIndex.end_time + PeriodIndex.freq + PeriodIndex.freqstr + PeriodIndex.hour + PeriodIndex.is_leap_year + PeriodIndex.minute + PeriodIndex.month + PeriodIndex.quarter + PeriodIndex.qyear + PeriodIndex.second + PeriodIndex.start_time + PeriodIndex.week + PeriodIndex.weekday + PeriodIndex.weekofyear + PeriodIndex.year + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + PeriodIndex.asfreq + PeriodIndex.strftime + PeriodIndex.to_timestamp diff --git a/doc/source/api/io.rst b/doc/source/api/io.rst new file mode 100644 index 00000000000000..ee9a991f931c6a --- /dev/null +++ b/doc/source/api/io.rst @@ -0,0 +1,139 @@ +{{ header }} + +.. _api.io: + +Input/Output +------------ +.. currentmodule:: pandas + +Pickling +~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_pickle + +Flat File +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_table + read_csv + read_fwf + read_msgpack + +Clipboard +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_clipboard + +Excel +~~~~~ +.. autosummary:: + :toctree: generated/ + + read_excel + ExcelFile.parse + +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + ExcelWriter + +JSON +~~~~ +.. autosummary:: + :toctree: generated/ + + read_json + +.. currentmodule:: pandas.io.json + +.. autosummary:: + :toctree: generated/ + + json_normalize + build_table_schema + +.. currentmodule:: pandas + +HTML +~~~~ +.. autosummary:: + :toctree: generated/ + + read_html + +HDFStore: PyTables (HDF5) +~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_hdf + HDFStore.put + HDFStore.append + HDFStore.get + HDFStore.select + HDFStore.info + HDFStore.keys + HDFStore.groups + HDFStore.walk + +Feather +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_feather + +Parquet +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_parquet + +SAS +~~~ +.. autosummary:: + :toctree: generated/ + + read_sas + +SQL +~~~ +.. autosummary:: + :toctree: generated/ + + read_sql_table + read_sql_query + read_sql + +Google BigQuery +~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + read_gbq + +STATA +~~~~~ +.. autosummary:: + :toctree: generated/ + + read_stata + +.. currentmodule:: pandas.io.stata + +.. autosummary:: + :toctree: generated/ + + StataReader.data + StataReader.data_label + StataReader.value_labels + StataReader.variable_labels + StataWriter.write_file diff --git a/doc/source/api/offset_frequency.rst b/doc/source/api/offset_frequency.rst new file mode 100644 index 00000000000000..f0068f3499dfd3 --- /dev/null +++ b/doc/source/api/offset_frequency.rst @@ -0,0 +1,1385 @@ +{{ header }} + +.. _api.dateoffsets: + +Date Offsets +------------ +.. currentmodule:: pandas.tseries.offsets + +DateOffset +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DateOffset + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DateOffset.freqstr + DateOffset.kwds + DateOffset.name + DateOffset.nanos + DateOffset.normalize + DateOffset.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + DateOffset.apply + DateOffset.copy + DateOffset.isAnchored + DateOffset.onOffset + +BusinessDay +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessDay + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessDay.freqstr + BusinessDay.kwds + BusinessDay.name + BusinessDay.nanos + BusinessDay.normalize + BusinessDay.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessDay.apply + BusinessDay.apply_index + BusinessDay.copy + BusinessDay.isAnchored + BusinessDay.onOffset + +BusinessHour +~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessHour + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessHour.freqstr + BusinessHour.kwds + BusinessHour.name + BusinessHour.nanos + BusinessHour.normalize + BusinessHour.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessHour.apply + BusinessHour.copy + BusinessHour.isAnchored + BusinessHour.onOffset + +CustomBusinessDay +~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessDay + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessDay.freqstr + CustomBusinessDay.kwds + CustomBusinessDay.name + CustomBusinessDay.nanos + CustomBusinessDay.normalize + CustomBusinessDay.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessDay.apply + CustomBusinessDay.copy + CustomBusinessDay.isAnchored + CustomBusinessDay.onOffset + +CustomBusinessHour +~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessHour + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessHour.freqstr + CustomBusinessHour.kwds + CustomBusinessHour.name + CustomBusinessHour.nanos + CustomBusinessHour.normalize + CustomBusinessHour.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessHour.apply + CustomBusinessHour.copy + CustomBusinessHour.isAnchored + CustomBusinessHour.onOffset + +MonthOffset +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthOffset + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthOffset.freqstr + MonthOffset.kwds + MonthOffset.name + MonthOffset.nanos + MonthOffset.normalize + MonthOffset.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthOffset.apply + MonthOffset.apply_index + MonthOffset.copy + MonthOffset.isAnchored + MonthOffset.onOffset + +MonthEnd +~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthEnd.freqstr + MonthEnd.kwds + MonthEnd.name + MonthEnd.nanos + MonthEnd.normalize + MonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthEnd.apply + MonthEnd.apply_index + MonthEnd.copy + MonthEnd.isAnchored + MonthEnd.onOffset + +MonthBegin +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthBegin.freqstr + MonthBegin.kwds + MonthBegin.name + MonthBegin.nanos + MonthBegin.normalize + MonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + MonthBegin.apply + MonthBegin.apply_index + MonthBegin.copy + MonthBegin.isAnchored + MonthBegin.onOffset + +BusinessMonthEnd +~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthEnd.freqstr + BusinessMonthEnd.kwds + BusinessMonthEnd.name + BusinessMonthEnd.nanos + BusinessMonthEnd.normalize + BusinessMonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthEnd.apply + BusinessMonthEnd.apply_index + BusinessMonthEnd.copy + BusinessMonthEnd.isAnchored + BusinessMonthEnd.onOffset + +BusinessMonthBegin +~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthBegin.freqstr + BusinessMonthBegin.kwds + BusinessMonthBegin.name + BusinessMonthBegin.nanos + BusinessMonthBegin.normalize + BusinessMonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BusinessMonthBegin.apply + BusinessMonthBegin.apply_index + BusinessMonthBegin.copy + BusinessMonthBegin.isAnchored + BusinessMonthBegin.onOffset + +CustomBusinessMonthEnd +~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthEnd.freqstr + CustomBusinessMonthEnd.kwds + CustomBusinessMonthEnd.m_offset + CustomBusinessMonthEnd.name + CustomBusinessMonthEnd.nanos + CustomBusinessMonthEnd.normalize + CustomBusinessMonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthEnd.apply + CustomBusinessMonthEnd.copy + CustomBusinessMonthEnd.isAnchored + CustomBusinessMonthEnd.onOffset + +CustomBusinessMonthBegin +~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthBegin.freqstr + CustomBusinessMonthBegin.kwds + CustomBusinessMonthBegin.m_offset + CustomBusinessMonthBegin.name + CustomBusinessMonthBegin.nanos + CustomBusinessMonthBegin.normalize + CustomBusinessMonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CustomBusinessMonthBegin.apply + CustomBusinessMonthBegin.copy + CustomBusinessMonthBegin.isAnchored + CustomBusinessMonthBegin.onOffset + +SemiMonthOffset +~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthOffset + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthOffset.freqstr + SemiMonthOffset.kwds + SemiMonthOffset.name + SemiMonthOffset.nanos + SemiMonthOffset.normalize + SemiMonthOffset.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthOffset.apply + SemiMonthOffset.apply_index + SemiMonthOffset.copy + SemiMonthOffset.isAnchored + SemiMonthOffset.onOffset + +SemiMonthEnd +~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthEnd.freqstr + SemiMonthEnd.kwds + SemiMonthEnd.name + SemiMonthEnd.nanos + SemiMonthEnd.normalize + SemiMonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthEnd.apply + SemiMonthEnd.apply_index + SemiMonthEnd.copy + SemiMonthEnd.isAnchored + SemiMonthEnd.onOffset + +SemiMonthBegin +~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthBegin.freqstr + SemiMonthBegin.kwds + SemiMonthBegin.name + SemiMonthBegin.nanos + SemiMonthBegin.normalize + SemiMonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + SemiMonthBegin.apply + SemiMonthBegin.apply_index + SemiMonthBegin.copy + SemiMonthBegin.isAnchored + SemiMonthBegin.onOffset + +Week +~~~~ +.. autosummary:: + :toctree: generated/ + + Week + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Week.freqstr + Week.kwds + Week.name + Week.nanos + Week.normalize + Week.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Week.apply + Week.apply_index + Week.copy + Week.isAnchored + Week.onOffset + +WeekOfMonth +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + WeekOfMonth + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + WeekOfMonth.freqstr + WeekOfMonth.kwds + WeekOfMonth.name + WeekOfMonth.nanos + WeekOfMonth.normalize + WeekOfMonth.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + WeekOfMonth.apply + WeekOfMonth.copy + WeekOfMonth.isAnchored + WeekOfMonth.onOffset + +LastWeekOfMonth +~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + LastWeekOfMonth + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + LastWeekOfMonth.freqstr + LastWeekOfMonth.kwds + LastWeekOfMonth.name + LastWeekOfMonth.nanos + LastWeekOfMonth.normalize + LastWeekOfMonth.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + LastWeekOfMonth.apply + LastWeekOfMonth.copy + LastWeekOfMonth.isAnchored + LastWeekOfMonth.onOffset + +QuarterOffset +~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterOffset + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterOffset.freqstr + QuarterOffset.kwds + QuarterOffset.name + QuarterOffset.nanos + QuarterOffset.normalize + QuarterOffset.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterOffset.apply + QuarterOffset.apply_index + QuarterOffset.copy + QuarterOffset.isAnchored + QuarterOffset.onOffset + +BQuarterEnd +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterEnd.freqstr + BQuarterEnd.kwds + BQuarterEnd.name + BQuarterEnd.nanos + BQuarterEnd.normalize + BQuarterEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterEnd.apply + BQuarterEnd.apply_index + BQuarterEnd.copy + BQuarterEnd.isAnchored + BQuarterEnd.onOffset + +BQuarterBegin +~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterBegin.freqstr + BQuarterBegin.kwds + BQuarterBegin.name + BQuarterBegin.nanos + BQuarterBegin.normalize + BQuarterBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BQuarterBegin.apply + BQuarterBegin.apply_index + BQuarterBegin.copy + BQuarterBegin.isAnchored + BQuarterBegin.onOffset + +QuarterEnd +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterEnd.freqstr + QuarterEnd.kwds + QuarterEnd.name + QuarterEnd.nanos + QuarterEnd.normalize + QuarterEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterEnd.apply + QuarterEnd.apply_index + QuarterEnd.copy + QuarterEnd.isAnchored + QuarterEnd.onOffset + +QuarterBegin +~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterBegin.freqstr + QuarterBegin.kwds + QuarterBegin.name + QuarterBegin.nanos + QuarterBegin.normalize + QuarterBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + QuarterBegin.apply + QuarterBegin.apply_index + QuarterBegin.copy + QuarterBegin.isAnchored + QuarterBegin.onOffset + +YearOffset +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearOffset + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearOffset.freqstr + YearOffset.kwds + YearOffset.name + YearOffset.nanos + YearOffset.normalize + YearOffset.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearOffset.apply + YearOffset.apply_index + YearOffset.copy + YearOffset.isAnchored + YearOffset.onOffset + +BYearEnd +~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearEnd.freqstr + BYearEnd.kwds + BYearEnd.name + BYearEnd.nanos + BYearEnd.normalize + BYearEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearEnd.apply + BYearEnd.apply_index + BYearEnd.copy + BYearEnd.isAnchored + BYearEnd.onOffset + +BYearBegin +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearBegin.freqstr + BYearBegin.kwds + BYearBegin.name + BYearBegin.nanos + BYearBegin.normalize + BYearBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BYearBegin.apply + BYearBegin.apply_index + BYearBegin.copy + BYearBegin.isAnchored + BYearBegin.onOffset + +YearEnd +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearEnd.freqstr + YearEnd.kwds + YearEnd.name + YearEnd.nanos + YearEnd.normalize + YearEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearEnd.apply + YearEnd.apply_index + YearEnd.copy + YearEnd.isAnchored + YearEnd.onOffset + +YearBegin +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearBegin.freqstr + YearBegin.kwds + YearBegin.name + YearBegin.nanos + YearBegin.normalize + YearBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + YearBegin.apply + YearBegin.apply_index + YearBegin.copy + YearBegin.isAnchored + YearBegin.onOffset + +FY5253 +~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253 + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253.freqstr + FY5253.kwds + FY5253.name + FY5253.nanos + FY5253.normalize + FY5253.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253.apply + FY5253.copy + FY5253.get_rule_code_suffix + FY5253.get_year_end + FY5253.isAnchored + FY5253.onOffset + +FY5253Quarter +~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253Quarter + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253Quarter.freqstr + FY5253Quarter.kwds + FY5253Quarter.name + FY5253Quarter.nanos + FY5253Quarter.normalize + FY5253Quarter.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + FY5253Quarter.apply + FY5253Quarter.copy + FY5253Quarter.get_weeks + FY5253Quarter.isAnchored + FY5253Quarter.onOffset + FY5253Quarter.year_has_extra_week + +Easter +~~~~~~ +.. autosummary:: + :toctree: generated/ + + Easter + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Easter.freqstr + Easter.kwds + Easter.name + Easter.nanos + Easter.normalize + Easter.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Easter.apply + Easter.copy + Easter.isAnchored + Easter.onOffset + +Tick +~~~~ +.. autosummary:: + :toctree: generated/ + + Tick + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Tick.delta + Tick.freqstr + Tick.kwds + Tick.name + Tick.nanos + Tick.normalize + Tick.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Tick.copy + Tick.isAnchored + Tick.onOffset + +Day +~~~ +.. autosummary:: + :toctree: generated/ + + Day + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Day.delta + Day.freqstr + Day.kwds + Day.name + Day.nanos + Day.normalize + Day.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Day.copy + Day.isAnchored + Day.onOffset + +Hour +~~~~ +.. autosummary:: + :toctree: generated/ + + Hour + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Hour.delta + Hour.freqstr + Hour.kwds + Hour.name + Hour.nanos + Hour.normalize + Hour.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Hour.copy + Hour.isAnchored + Hour.onOffset + +Minute +~~~~~~ +.. autosummary:: + :toctree: generated/ + + Minute + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Minute.delta + Minute.freqstr + Minute.kwds + Minute.name + Minute.nanos + Minute.normalize + Minute.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Minute.copy + Minute.isAnchored + Minute.onOffset + +Second +~~~~~~ +.. autosummary:: + :toctree: generated/ + + Second + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Second.delta + Second.freqstr + Second.kwds + Second.name + Second.nanos + Second.normalize + Second.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Second.copy + Second.isAnchored + Second.onOffset + +Milli +~~~~~ +.. autosummary:: + :toctree: generated/ + + Milli + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Milli.delta + Milli.freqstr + Milli.kwds + Milli.name + Milli.nanos + Milli.normalize + Milli.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Milli.copy + Milli.isAnchored + Milli.onOffset + +Micro +~~~~~ +.. autosummary:: + :toctree: generated/ + + Micro + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Micro.delta + Micro.freqstr + Micro.kwds + Micro.name + Micro.nanos + Micro.normalize + Micro.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Micro.copy + Micro.isAnchored + Micro.onOffset + +Nano +~~~~ +.. autosummary:: + :toctree: generated/ + + Nano + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Nano.delta + Nano.freqstr + Nano.kwds + Nano.name + Nano.nanos + Nano.normalize + Nano.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Nano.copy + Nano.isAnchored + Nano.onOffset + +BDay +~~~~ +.. autosummary:: + :toctree: generated/ + + BDay + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BDay.base + BDay.freqstr + BDay.kwds + BDay.name + BDay.nanos + BDay.normalize + BDay.offset + BDay.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BDay.apply + BDay.apply_index + BDay.copy + BDay.isAnchored + BDay.onOffset + BDay.rollback + BDay.rollforward + +BMonthEnd +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthEnd.base + BMonthEnd.freqstr + BMonthEnd.kwds + BMonthEnd.name + BMonthEnd.nanos + BMonthEnd.normalize + BMonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthEnd.apply + BMonthEnd.apply_index + BMonthEnd.copy + BMonthEnd.isAnchored + BMonthEnd.onOffset + BMonthEnd.rollback + BMonthEnd.rollforward + +BMonthBegin +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthBegin.base + BMonthBegin.freqstr + BMonthBegin.kwds + BMonthBegin.name + BMonthBegin.nanos + BMonthBegin.normalize + BMonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + BMonthBegin.apply + BMonthBegin.apply_index + BMonthBegin.copy + BMonthBegin.isAnchored + BMonthBegin.onOffset + BMonthBegin.rollback + BMonthBegin.rollforward + +CBMonthEnd +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthEnd + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthEnd.base + CBMonthEnd.cbday_roll + CBMonthEnd.freqstr + CBMonthEnd.kwds + CBMonthEnd.m_offset + CBMonthEnd.month_roll + CBMonthEnd.name + CBMonthEnd.nanos + CBMonthEnd.normalize + CBMonthEnd.offset + CBMonthEnd.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthEnd.apply + CBMonthEnd.apply_index + CBMonthEnd.copy + CBMonthEnd.isAnchored + CBMonthEnd.onOffset + CBMonthEnd.rollback + CBMonthEnd.rollforward + +CBMonthBegin +~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthBegin + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthBegin.base + CBMonthBegin.cbday_roll + CBMonthBegin.freqstr + CBMonthBegin.kwds + CBMonthBegin.m_offset + CBMonthBegin.month_roll + CBMonthBegin.name + CBMonthBegin.nanos + CBMonthBegin.normalize + CBMonthBegin.offset + CBMonthBegin.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CBMonthBegin.apply + CBMonthBegin.apply_index + CBMonthBegin.copy + CBMonthBegin.isAnchored + CBMonthBegin.onOffset + CBMonthBegin.rollback + CBMonthBegin.rollforward + +CDay +~~~~ +.. autosummary:: + :toctree: generated/ + + CDay + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CDay.base + CDay.freqstr + CDay.kwds + CDay.name + CDay.nanos + CDay.normalize + CDay.offset + CDay.rule_code + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + CDay.apply + CDay.apply_index + CDay.copy + CDay.isAnchored + CDay.onOffset + CDay.rollback + CDay.rollforward + +.. _api.frequencies: + +Frequencies +----------- +.. currentmodule:: pandas.tseries.frequencies + +.. _api.offsets: + +.. autosummary:: + :toctree: generated/ + + to_offset diff --git a/doc/source/api/panel.rst b/doc/source/api/panel.rst new file mode 100644 index 00000000000000..00664a78c32b4a --- /dev/null +++ b/doc/source/api/panel.rst @@ -0,0 +1,207 @@ +{{ header }} + +.. _api.panel: + +Panel +------ +.. currentmodule:: pandas + +Constructor +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel + +Attributes and underlying data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**Axes** + +* **items**: axis 0; each item corresponds to a DataFrame contained inside +* **major_axis**: axis 1; the index (rows) of each of the DataFrames +* **minor_axis**: axis 2; the columns of each of the DataFrames + +.. autosummary:: + :toctree: generated/ + + Panel.values + Panel.axes + Panel.ndim + Panel.size + Panel.shape + Panel.dtypes + Panel.ftypes + Panel.get_dtype_counts + Panel.get_ftype_counts + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.astype + Panel.copy + Panel.isna + Panel.notna + +Getting and setting +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.get_value + Panel.set_value + +Indexing, iteration, slicing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.at + Panel.iat + Panel.loc + Panel.iloc + Panel.__iter__ + Panel.iteritems + Panel.pop + Panel.xs + Panel.major_xs + Panel.minor_xs + +For more information on ``.at``, ``.iat``, ``.loc``, and +``.iloc``, see the :ref:`indexing documentation `. + +Binary operator functions +~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.add + Panel.sub + Panel.mul + Panel.div + Panel.truediv + Panel.floordiv + Panel.mod + Panel.pow + Panel.radd + Panel.rsub + Panel.rmul + Panel.rdiv + Panel.rtruediv + Panel.rfloordiv + Panel.rmod + Panel.rpow + Panel.lt + Panel.gt + Panel.le + Panel.ge + Panel.ne + Panel.eq + +Function application, GroupBy +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.apply + Panel.groupby + +.. _api.panel.stats: + +Computations / Descriptive Stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.abs + Panel.clip + Panel.clip_lower + Panel.clip_upper + Panel.count + Panel.cummax + Panel.cummin + Panel.cumprod + Panel.cumsum + Panel.max + Panel.mean + Panel.median + Panel.min + Panel.pct_change + Panel.prod + Panel.sem + Panel.skew + Panel.sum + Panel.std + Panel.var + +Reindexing / Selection / Label manipulation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.add_prefix + Panel.add_suffix + Panel.drop + Panel.equals + Panel.filter + Panel.first + Panel.last + Panel.reindex + Panel.reindex_axis + Panel.reindex_like + Panel.rename + Panel.sample + Panel.select + Panel.take + Panel.truncate + +Missing data handling +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.dropna + +Reshaping, sorting, transposing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.sort_index + Panel.swaplevel + Panel.transpose + Panel.swapaxes + Panel.conform + +Combining / joining / merging +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.join + Panel.update + +Time series-related +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.asfreq + Panel.shift + Panel.resample + Panel.tz_convert + Panel.tz_localize + +Serialization / IO / Conversion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Panel.from_dict + Panel.to_pickle + Panel.to_excel + Panel.to_hdf + Panel.to_sparse + Panel.to_frame + Panel.to_clipboard diff --git a/doc/source/api/plotting.rst b/doc/source/api/plotting.rst new file mode 100644 index 00000000000000..4d19cabd43a8bf --- /dev/null +++ b/doc/source/api/plotting.rst @@ -0,0 +1,21 @@ +{{ header }} + +.. _api.plotting: + +Plotting +-------- +.. currentmodule:: pandas.plotting + +The following functions are contained in the `pandas.plotting` module. + +.. autosummary:: + :toctree: generated/ + + andrews_curves + bootstrap_plot + deregister_matplotlib_converters + lag_plot + parallel_coordinates + radviz + register_matplotlib_converters + scatter_matrix diff --git a/doc/source/api/resampling.rst b/doc/source/api/resampling.rst new file mode 100644 index 00000000000000..e6877ee6f0fb81 --- /dev/null +++ b/doc/source/api/resampling.rst @@ -0,0 +1,65 @@ +{{ header }} + +.. _api.resampling: + +Resampling +---------- +.. currentmodule:: pandas.core.resample + +Resampler objects are returned by resample calls: :func:`pandas.DataFrame.resample`, :func:`pandas.Series.resample`. + +Indexing, iteration +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Resampler.__iter__ + Resampler.groups + Resampler.indices + Resampler.get_group + +Function application +~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Resampler.apply + Resampler.aggregate + Resampler.transform + Resampler.pipe + +Upsampling +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Resampler.ffill + Resampler.backfill + Resampler.bfill + Resampler.pad + Resampler.nearest + Resampler.fillna + Resampler.asfreq + Resampler.interpolate + +Computations / Descriptive Stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Resampler.count + Resampler.nunique + Resampler.first + Resampler.last + Resampler.max + Resampler.mean + Resampler.median + Resampler.min + Resampler.ohlc + Resampler.prod + Resampler.size + Resampler.sem + Resampler.std + Resampler.sum + Resampler.var + Resampler.quantile diff --git a/doc/source/api/scalars.rst b/doc/source/api/scalars.rst new file mode 100644 index 00000000000000..6ea0d9f87d5c0a --- /dev/null +++ b/doc/source/api/scalars.rst @@ -0,0 +1,203 @@ +{{ header }} + +.. _api.scalars: + +Scalars +------- +.. currentmodule:: pandas + +Period +~~~~~~ +.. autosummary:: + :toctree: generated/ + + Period + +Attributes +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Period.day + Period.dayofweek + Period.dayofyear + Period.days_in_month + Period.daysinmonth + Period.end_time + Period.freq + Period.freqstr + Period.hour + Period.is_leap_year + Period.minute + Period.month + Period.ordinal + Period.quarter + Period.qyear + Period.second + Period.start_time + Period.week + Period.weekday + Period.weekofyear + Period.year + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Period.asfreq + Period.now + Period.strftime + Period.to_timestamp + +Timestamp +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timestamp + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timestamp.asm8 + Timestamp.day + Timestamp.dayofweek + Timestamp.dayofyear + Timestamp.days_in_month + Timestamp.daysinmonth + Timestamp.fold + Timestamp.hour + Timestamp.is_leap_year + Timestamp.is_month_end + Timestamp.is_month_start + Timestamp.is_quarter_end + Timestamp.is_quarter_start + Timestamp.is_year_end + Timestamp.is_year_start + Timestamp.max + Timestamp.microsecond + Timestamp.min + Timestamp.minute + Timestamp.month + Timestamp.nanosecond + Timestamp.quarter + Timestamp.resolution + Timestamp.second + Timestamp.tz + Timestamp.tzinfo + Timestamp.value + Timestamp.week + Timestamp.weekofyear + Timestamp.year + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timestamp.astimezone + Timestamp.ceil + Timestamp.combine + Timestamp.ctime + Timestamp.date + Timestamp.day_name + Timestamp.dst + Timestamp.floor + Timestamp.freq + Timestamp.freqstr + Timestamp.fromordinal + Timestamp.fromtimestamp + Timestamp.isocalendar + Timestamp.isoformat + Timestamp.isoweekday + Timestamp.month_name + Timestamp.normalize + Timestamp.now + Timestamp.replace + Timestamp.round + Timestamp.strftime + Timestamp.strptime + Timestamp.time + Timestamp.timestamp + Timestamp.timetuple + Timestamp.timetz + Timestamp.to_datetime64 + Timestamp.to_julian_date + Timestamp.to_period + Timestamp.to_pydatetime + Timestamp.today + Timestamp.toordinal + Timestamp.tz_convert + Timestamp.tz_localize + Timestamp.tzname + Timestamp.utcfromtimestamp + Timestamp.utcnow + Timestamp.utcoffset + Timestamp.utctimetuple + Timestamp.weekday + +Interval +~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Interval + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Interval.closed + Interval.closed_left + Interval.closed_right + Interval.left + Interval.length + Interval.mid + Interval.open_left + Interval.open_right + Interval.overlaps + Interval.right + +Timedelta +~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timedelta + +Properties +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timedelta.asm8 + Timedelta.components + Timedelta.days + Timedelta.delta + Timedelta.freq + Timedelta.is_populated + Timedelta.max + Timedelta.microseconds + Timedelta.min + Timedelta.nanoseconds + Timedelta.resolution + Timedelta.seconds + Timedelta.value + Timedelta.view + +Methods +~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Timedelta.ceil + Timedelta.floor + Timedelta.isoformat + Timedelta.round + Timedelta.to_pytimedelta + Timedelta.to_timedelta64 + Timedelta.total_seconds diff --git a/doc/source/api/series.rst b/doc/source/api/series.rst new file mode 100644 index 00000000000000..d3350ecacb5433 --- /dev/null +++ b/doc/source/api/series.rst @@ -0,0 +1,617 @@ +{{ header }} + +.. _api.series: + +Series +------ +.. currentmodule:: pandas + +Constructor +~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series + +Attributes +~~~~~~~~~~ +**Axes** + +.. autosummary:: + :toctree: generated/ + + Series.index + +.. autosummary:: + :toctree: generated/ + + Series.values + Series.dtype + Series.ftype + Series.shape + Series.nbytes + Series.ndim + Series.size + Series.strides + Series.itemsize + Series.base + Series.T + Series.memory_usage + Series.hasnans + Series.flags + Series.empty + Series.dtypes + Series.ftypes + Series.data + Series.is_copy + Series.name + Series.put + +Conversion +~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.astype + Series.infer_objects + Series.convert_objects + Series.copy + Series.bool + Series.to_period + Series.to_timestamp + Series.to_list + Series.get_values + +Indexing, iteration +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.get + Series.at + Series.iat + Series.loc + Series.iloc + Series.__iter__ + Series.iteritems + Series.items + Series.keys + Series.pop + Series.item + Series.xs + +For more information on ``.at``, ``.iat``, ``.loc``, and +``.iloc``, see the :ref:`indexing documentation `. + +Binary operator functions +~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.add + Series.sub + Series.mul + Series.div + Series.truediv + Series.floordiv + Series.mod + Series.pow + Series.radd + Series.rsub + Series.rmul + Series.rdiv + Series.rtruediv + Series.rfloordiv + Series.rmod + Series.rpow + Series.combine + Series.combine_first + Series.round + Series.lt + Series.gt + Series.le + Series.ge + Series.ne + Series.eq + Series.product + Series.dot + +Function application, GroupBy & Window +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.apply + Series.agg + Series.aggregate + Series.transform + Series.map + Series.groupby + Series.rolling + Series.expanding + Series.ewm + Series.pipe + +.. _api.series.stats: + +Computations / Descriptive Stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.abs + Series.all + Series.any + Series.autocorr + Series.between + Series.clip + Series.clip_lower + Series.clip_upper + Series.corr + Series.count + Series.cov + Series.cummax + Series.cummin + Series.cumprod + Series.cumsum + Series.describe + Series.diff + Series.factorize + Series.kurt + Series.mad + Series.max + Series.mean + Series.median + Series.min + Series.mode + Series.nlargest + Series.nsmallest + Series.pct_change + Series.prod + Series.quantile + Series.rank + Series.sem + Series.skew + Series.std + Series.sum + Series.var + Series.kurtosis + Series.unique + Series.nunique + Series.is_unique + Series.is_monotonic + Series.is_monotonic_increasing + Series.is_monotonic_decreasing + Series.value_counts + Series.compound + Series.nonzero + +Reindexing / Selection / Label manipulation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.align + Series.drop + Series.droplevel + Series.drop_duplicates + Series.duplicated + Series.equals + Series.first + Series.head + Series.idxmax + Series.idxmin + Series.isin + Series.last + Series.reindex + Series.reindex_like + Series.rename + Series.rename_axis + Series.reset_index + Series.sample + Series.select + Series.set_axis + Series.take + Series.tail + Series.truncate + Series.where + Series.mask + Series.add_prefix + Series.add_suffix + Series.filter + +Missing data handling +~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.isna + Series.notna + Series.dropna + Series.fillna + Series.interpolate + +Reshaping, sorting +~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.argsort + Series.argmin + Series.argmax + Series.reorder_levels + Series.sort_values + Series.sort_index + Series.swaplevel + Series.unstack + Series.searchsorted + Series.ravel + Series.repeat + Series.squeeze + Series.view + +Combining / joining / merging +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.append + Series.replace + Series.update + +Time series-related +~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.asfreq + Series.asof + Series.shift + Series.first_valid_index + Series.last_valid_index + Series.resample + Series.tz_convert + Series.tz_localize + Series.at_time + Series.between_time + Series.tshift + Series.slice_shift + +Datetimelike Properties +~~~~~~~~~~~~~~~~~~~~~~~ +``Series.dt`` can be used to access the values of the series as +datetimelike and return several properties. +These can be accessed like ``Series.dt.``. + +**Datetime Properties** + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_attribute.rst + + Series.dt.date + Series.dt.time + Series.dt.timetz + Series.dt.year + Series.dt.month + Series.dt.day + Series.dt.hour + Series.dt.minute + Series.dt.second + Series.dt.microsecond + Series.dt.nanosecond + Series.dt.week + Series.dt.weekofyear + Series.dt.dayofweek + Series.dt.weekday + Series.dt.dayofyear + Series.dt.quarter + Series.dt.is_month_start + Series.dt.is_month_end + Series.dt.is_quarter_start + Series.dt.is_quarter_end + Series.dt.is_year_start + Series.dt.is_year_end + Series.dt.is_leap_year + Series.dt.daysinmonth + Series.dt.days_in_month + Series.dt.tz + Series.dt.freq + +**Datetime Methods** + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + Series.dt.to_period + Series.dt.to_pydatetime + Series.dt.tz_localize + Series.dt.tz_convert + Series.dt.normalize + Series.dt.strftime + Series.dt.round + Series.dt.floor + Series.dt.ceil + Series.dt.month_name + Series.dt.day_name + +**Period Properties** + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_attribute.rst + + Series.dt.qyear + Series.dt.start_time + Series.dt.end_time + +**Timedelta Properties** + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_attribute.rst + + Series.dt.days + Series.dt.seconds + Series.dt.microseconds + Series.dt.nanoseconds + Series.dt.components + +**Timedelta Methods** + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + Series.dt.to_pytimedelta + Series.dt.total_seconds + +String handling +~~~~~~~~~~~~~~~ +``Series.str`` can be used to access the values of the series as +strings and apply several methods to it. These can be accessed like +``Series.str.``. + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + Series.str.capitalize + Series.str.cat + Series.str.center + Series.str.contains + Series.str.count + Series.str.decode + Series.str.encode + Series.str.endswith + Series.str.extract + Series.str.extractall + Series.str.find + Series.str.findall + Series.str.get + Series.str.index + Series.str.join + Series.str.len + Series.str.ljust + Series.str.lower + Series.str.lstrip + Series.str.match + Series.str.normalize + Series.str.pad + Series.str.partition + Series.str.repeat + Series.str.replace + Series.str.rfind + Series.str.rindex + Series.str.rjust + Series.str.rpartition + Series.str.rstrip + Series.str.slice + Series.str.slice_replace + Series.str.split + Series.str.rsplit + Series.str.startswith + Series.str.strip + Series.str.swapcase + Series.str.title + Series.str.translate + Series.str.upper + Series.str.wrap + Series.str.zfill + Series.str.isalnum + Series.str.isalpha + Series.str.isdigit + Series.str.isspace + Series.str.islower + Series.str.isupper + Series.str.istitle + Series.str.isnumeric + Series.str.isdecimal + Series.str.get_dummies + +.. + The following is needed to ensure the generated pages are created with the + correct template (otherwise they would be created in the Series/Index class page) + +.. + .. autosummary:: + :toctree: generated/ + :template: autosummary/accessor.rst + + Series.str + Series.cat + Series.dt + Index.str + +.. _api.arrays: + +Arrays +------ +Pandas and third-party libraries can extend NumPy's type system (see :ref:`extending.extension-types`). + +.. autosummary:: + :toctree: generated/ + + array + +.. _api.categorical: + +Categorical +~~~~~~~~~~~ + +Pandas defines a custom data type for representing data that can take only a +limited, fixed set of values. The dtype of a ``Categorical`` can be described by +a :class:`pandas.api.types.CategoricalDtype`. + +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + api.types.CategoricalDtype + +.. autosummary:: + :toctree: generated/ + + api.types.CategoricalDtype.categories + api.types.CategoricalDtype.ordered + +Categorical data can be stored in a :class:`pandas.Categorical` + +.. autosummary:: + :toctree: generated/ + :template: autosummary/class_without_autosummary.rst + + Categorical + +The alternative :meth:`Categorical.from_codes` constructor can be used when you +have the categories and integer codes already: + +.. autosummary:: + :toctree: generated/ + + Categorical.from_codes + +The dtype information is available on the ``Categorical`` + +.. autosummary:: + :toctree: generated/ + + Categorical.dtype + Categorical.categories + Categorical.ordered + Categorical.codes + +``np.asarray(categorical)`` works by implementing the array interface. Be aware, that this converts +the Categorical back to a NumPy array, so categories and order information is not preserved! + +.. autosummary:: + :toctree: generated/ + + Categorical.__array__ + +A ``Categorical`` can be stored in a ``Series`` or ``DataFrame``. +To create a Series of dtype ``category``, use ``cat = s.astype(dtype)`` or +``Series(..., dtype=dtype)`` where ``dtype`` is either + +* the string ``'category'`` +* an instance of :class:`~pandas.api.types.CategoricalDtype`. + +If the Series is of dtype ``CategoricalDtype``, ``Series.cat`` can be used to change the categorical +data. This accessor is similar to the ``Series.dt`` or ``Series.str`` and has the +following usable methods and properties: + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_attribute.rst + + Series.cat.categories + Series.cat.ordered + Series.cat.codes + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + Series.cat.rename_categories + Series.cat.reorder_categories + Series.cat.add_categories + Series.cat.remove_categories + Series.cat.remove_unused_categories + Series.cat.set_categories + Series.cat.as_ordered + Series.cat.as_unordered + +Plotting +~~~~~~~~ +``Series.plot`` is both a callable method and a namespace attribute for +specific plotting methods of the form ``Series.plot.``. + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_callable.rst + + Series.plot + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_method.rst + + Series.plot.area + Series.plot.bar + Series.plot.barh + Series.plot.box + Series.plot.density + Series.plot.hist + Series.plot.kde + Series.plot.line + Series.plot.pie + +.. autosummary:: + :toctree: generated/ + + Series.hist + +Serialization / IO / Conversion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Series.to_pickle + Series.to_csv + Series.to_dict + Series.to_excel + Series.to_frame + Series.to_xarray + Series.to_hdf + Series.to_sql + Series.to_msgpack + Series.to_json + Series.to_sparse + Series.to_dense + Series.to_string + Series.to_clipboard + Series.to_latex + +Sparse +~~~~~~ +.. autosummary:: + :toctree: generated/ + + SparseSeries.to_coo + SparseSeries.from_coo + +.. autosummary:: + :toctree: generated/ + :template: autosummary/accessor_attribute.rst + + Series.sparse.npoints + Series.sparse.density + Series.sparse.fill_value + Series.sparse.sp_values + +.. autosummary:: + :toctree: generated/ + + Series.sparse.from_coo + Series.sparse.to_coo diff --git a/doc/source/api/style.rst b/doc/source/api/style.rst new file mode 100644 index 00000000000000..05f4a8b37fd092 --- /dev/null +++ b/doc/source/api/style.rst @@ -0,0 +1,65 @@ +{{ header }} + +.. _api.style: + +Style +----- +.. currentmodule:: pandas.io.formats.style + +``Styler`` objects are returned by :attr:`pandas.DataFrame.style`. + +Styler Constructor +~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Styler + Styler.from_custom_template + +Styler Attributes +~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Styler.env + Styler.template + Styler.loader + +Style Application +~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Styler.apply + Styler.applymap + Styler.where + Styler.format + Styler.set_precision + Styler.set_table_styles + Styler.set_table_attributes + Styler.set_caption + Styler.set_properties + Styler.set_uuid + Styler.clear + Styler.pipe + +Builtin Styles +~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Styler.highlight_max + Styler.highlight_min + Styler.highlight_null + Styler.background_gradient + Styler.bar + +Style Export and Import +~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Styler.render + Styler.export + Styler.use + Styler.to_excel diff --git a/doc/source/api/window.rst b/doc/source/api/window.rst new file mode 100644 index 00000000000000..23eb3c6864ae21 --- /dev/null +++ b/doc/source/api/window.rst @@ -0,0 +1,68 @@ +{{ header }} + +.. _api.window: + +Window +------ +.. currentmodule:: pandas.core.window + +Rolling objects are returned by ``.rolling`` calls: :func:`pandas.DataFrame.rolling`, :func:`pandas.Series.rolling`, etc. +Expanding objects are returned by ``.expanding`` calls: :func:`pandas.DataFrame.expanding`, :func:`pandas.Series.expanding`, etc. +EWM objects are returned by ``.ewm`` calls: :func:`pandas.DataFrame.ewm`, :func:`pandas.Series.ewm`, etc. + +Standard moving window functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Rolling.count + Rolling.sum + Rolling.mean + Rolling.median + Rolling.var + Rolling.std + Rolling.min + Rolling.max + Rolling.corr + Rolling.cov + Rolling.skew + Rolling.kurt + Rolling.apply + Rolling.aggregate + Rolling.quantile + Window.mean + Window.sum + +.. _api.functions_expanding: + +Standard expanding window functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + Expanding.count + Expanding.sum + Expanding.mean + Expanding.median + Expanding.var + Expanding.std + Expanding.min + Expanding.max + Expanding.corr + Expanding.cov + Expanding.skew + Expanding.kurt + Expanding.apply + Expanding.aggregate + Expanding.quantile + +Exponentially-weighted moving window functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autosummary:: + :toctree: generated/ + + EWM.mean + EWM.std + EWM.var + EWM.corr + EWM.cov diff --git a/doc/source/basics.rst b/doc/source/basics.rst index a35c9a23fbaba4..8dca000dfa969a 100644 --- a/doc/source/basics.rst +++ b/doc/source/basics.rst @@ -156,7 +156,7 @@ to these in old code bases and online. Going forward, we recommend avoiding ``.values`` and using ``.array`` or ``.to_numpy()``. ``.values`` has the following drawbacks: -1. When your Series contains an :ref:`extension type `, it's +1. When your Series contains an :ref:`extension type `, it's unclear whether :attr:`Series.values` returns a NumPy array or the extension array. :attr:`Series.array` will always return an ``ExtensionArray``, and will never copy data. :meth:`Series.to_numpy` will always return a NumPy array, diff --git a/doc/source/conf.py b/doc/source/conf.py index 452f0ffa77b806..2727a7ceb643b6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,23 +13,17 @@ import sys import os -import re import inspect import importlib import logging import warnings - +import jinja2 from sphinx.ext.autosummary import _import_by_name from numpydoc.docscrape import NumpyDocString from numpydoc.docscrape_sphinx import SphinxDocString logger = logging.getLogger(__name__) -try: - raw_input # Python 2 -except NameError: - raw_input = input # Python 3 - # https://github.com/sphinx-doc/sphinx/pull/2325/files # Workaround for sphinx-build recursion limit overflow: # pickle.dump(doctree, f, pickle.HIGHEST_PROTOCOL) @@ -77,18 +71,46 @@ ] exclude_patterns = ['**.ipynb_checkpoints'] - -with open("index.rst") as f: - index_rst_lines = f.readlines() - -# only include the slow autosummary feature if we're building the API section -# of the docs - -# JP: added from sphinxdocs -autosummary_generate = False - -if any(re.match(r"\s*api\s*", l) for l in index_rst_lines): - autosummary_generate = True +try: + import nbconvert +except ImportError: + logger.warn('nbconvert not installed. Skipping notebooks.') + exclude_patterns.append('**/*.ipynb') +else: + try: + nbconvert.utils.pandoc.get_pandoc_version() + except nbconvert.utils.pandoc.PandocMissing: + logger.warn('Pandoc not installed. Skipping notebooks.') + exclude_patterns.append('**/*.ipynb') + +# sphinx_pattern can be '-api' to exclude the API pages, +# the path to a file, or a Python object +# (e.g. '10min.rst' or 'pandas.DataFrame.head') +source_path = os.path.dirname(os.path.abspath(__file__)) +pattern = os.environ.get('SPHINX_PATTERN') +if pattern: + for dirname, dirs, fnames in os.walk(source_path): + for fname in fnames: + if os.path.splitext(fname)[-1] in ('.rst', '.ipynb'): + fname = os.path.relpath(os.path.join(dirname, fname), + source_path) + + if (fname == 'index.rst' + and os.path.abspath(dirname) == source_path): + continue + elif pattern == '-api' and dirname == 'api': + exclude_patterns.append(fname) + elif fname != pattern: + exclude_patterns.append(fname) + +with open(os.path.join(source_path, 'index.rst.template')) as f: + t = jinja2.Template(f.read()) +with open(os.path.join(source_path, 'index.rst'), 'w') as f: + f.write(t.render(include_api=pattern is None, + single_doc=(pattern + if pattern is not None and pattern != '-api' + else None))) +autosummary_generate = True if pattern is None else ['index'] # matplotlib plot directive plot_include_source = True @@ -277,10 +299,11 @@ "{new}.{method}".format(new=new, method=method)) ) -html_additional_pages = { - 'generated/' + page[0]: 'api_redirect.html' - for page in moved_api_pages -} +if pattern is None: + html_additional_pages = { + 'generated/' + page[0]: 'api_redirect.html' + for page in moved_api_pages + } header = """\ @@ -370,18 +393,17 @@ # latex_use_modindex = True -intersphinx_mapping = { - 'dateutil': ("https://dateutil.readthedocs.io/en/latest/", None), - 'matplotlib': ('https://matplotlib.org/', None), - 'numpy': ('https://docs.scipy.org/doc/numpy/', None), - 'pandas-gbq': ('https://pandas-gbq.readthedocs.io/en/latest/', None), - 'py': ('https://pylib.readthedocs.io/en/latest/', None), - 'python': ('https://docs.python.org/3/', None), - 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), - 'statsmodels': ('http://www.statsmodels.org/devel/', None), -} -import glob -autosummary_generate = glob.glob("*.rst") +if pattern is None: + intersphinx_mapping = { + 'dateutil': ("https://dateutil.readthedocs.io/en/latest/", None), + 'matplotlib': ('https://matplotlib.org/', None), + 'numpy': ('https://docs.scipy.org/doc/numpy/', None), + 'pandas-gbq': ('https://pandas-gbq.readthedocs.io/en/latest/', None), + 'py': ('https://pylib.readthedocs.io/en/latest/', None), + 'python': ('https://docs.python.org/3/', None), + 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), + 'statsmodels': ('http://www.statsmodels.org/devel/', None), + } # extlinks alias extlinks = {'issue': ('https://github.com/pandas-dev/pandas/issues/%s', diff --git a/doc/source/ecosystem.rst b/doc/source/ecosystem.rst index a5d1ec7b257d83..833308ec9fcc68 100644 --- a/doc/source/ecosystem.rst +++ b/doc/source/ecosystem.rst @@ -142,7 +142,8 @@ which are utilized by Jupyter Notebook for displaying (Note: HTML tables may or may not be compatible with non-HTML Jupyter output formats.) -See :ref:`Options and Settings ` and :ref:`` +See :ref:`Options and Settings ` and +:ref:`Available Options ` for pandas ``display.`` settings. `quantopian/qgrid `__ diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index 38f73f8617ced6..7fe26d68c6fd05 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -106,17 +106,21 @@ Some other notes See the package overview for more detail about what's in the library. -{% if single_doc_type == 'docstring' -%} +{% if single_doc and single_doc.endswith('.rst') -%} +.. toctree:: + :maxdepth: 4 + + {{ single_doc[:-4] }} +{% elif single_doc %} .. autosummary:: - :toctree: generated_single/ + :toctree: api/generated/ + + {{ single_doc }} {% else -%} .. toctree:: :maxdepth: 4 {% endif %} - {% if single_doc -%} - {{ single_doc }} - {% endif -%} {% if not single_doc -%} What's New install @@ -153,7 +157,7 @@ See the package overview for more detail about what's in the library. comparison_with_stata {% endif -%} {% if include_api -%} - api + api/index {% endif -%} {% if not single_doc -%} developer diff --git a/doc/source/whatsnew/v0.24.0.rst b/doc/source/whatsnew/v0.24.0.rst index affef80571fce7..b4331aab3085f0 100644 --- a/doc/source/whatsnew/v0.24.0.rst +++ b/doc/source/whatsnew/v0.24.0.rst @@ -1367,6 +1367,7 @@ Datetimelike - Bug in :attr:`Series.dt` where the cache would not update properly after an in-place operation (:issue:`24408`) - Bug in :class:`PeriodIndex` where comparisons against an array-like object with length 1 failed to raise ``ValueError`` (:issue:`23078`) - Bug in :meth:`DatetimeIndex.astype`, :meth:`PeriodIndex.astype` and :meth:`TimedeltaIndex.astype` ignoring the sign of the ``dtype`` for unsigned integer dtypes (:issue:`24405`). +- Fixed bug in :meth:`Series.max` with ``datetime64[ns]``-dtype failing to return ``NaT`` when nulls are present and ``skipna=False`` is passed (:issue:`24265`) Timedelta ^^^^^^^^^ @@ -1412,6 +1413,7 @@ Timezones - Bug in :class:`Timestamp` constructor where a ``dateutil.tz.tzutc`` timezone passed with a ``datetime.datetime`` argument would be converted to a ``pytz.UTC`` timezone (:issue:`23807`) - Bug in :func:`to_datetime` where ``utc=True`` was not respected when specifying a ``unit`` and ``errors='ignore'`` (:issue:`23758`) - Bug in :func:`to_datetime` where ``utc=True`` was not respected when passing a :class:`Timestamp` (:issue:`24415`) +- Bug in :meth:`DataFrame.any` returns wrong value when ``axis=1`` and the data is of datetimelike type (:issue:`23070`) Offsets ^^^^^^^ @@ -1439,7 +1441,7 @@ Numeric - :meth:`Series.agg` can now handle numpy NaN-aware methods like :func:`numpy.nansum` (:issue:`19629`) - Bug in :meth:`Series.rank` and :meth:`DataFrame.rank` when ``pct=True`` and more than 2:sup:`24` rows are present resulted in percentages greater than 1.0 (:issue:`18271`) - Calls such as :meth:`DataFrame.round` with a non-unique :meth:`CategoricalIndex` now return expected data. Previously, data would be improperly duplicated (:issue:`21809`). -- Added ``log10`` to the list of supported functions in :meth:`DataFrame.eval` (:issue:`24139`) +- Added ``log10``, `floor` and `ceil` to the list of supported functions in :meth:`DataFrame.eval` (:issue:`24139`, :issue:`24353`) - Logical operations ``&, |, ^`` between :class:`Series` and :class:`Index` will no longer raise ``ValueError`` (:issue:`22092`) - Checking PEP 3141 numbers in :func:`~pandas.api.types.is_scalar` function returns ``True`` (:issue:`22903`) - Reduction methods like :meth:`Series.sum` now accept the default value of ``keepdims=False`` when called from a NumPy ufunc, rather than raising a ``TypeError``. Full support for ``keepdims`` has not been implemented (:issue:`24356`). diff --git a/pandas/conftest.py b/pandas/conftest.py index f383fb32810e75..851a779db2159a 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,3 +1,4 @@ +import collections from datetime import date, time, timedelta from decimal import Decimal import importlib @@ -54,14 +55,22 @@ def pytest_runtest_setup(item): if 'network' in item.keywords and item.config.getoption("--skip-network"): pytest.skip("skipping due to --skip-network") - if 'db' in item.keywords and item.config.getoption("--skip-db"): - pytest.skip("skipping due to --skip-db") - if 'high_memory' in item.keywords and not item.config.getoption( "--run-high-memory"): pytest.skip( "skipping high memory test since --run-high-memory was not set") + # if "db" not explicitly set in the -m pattern, we skip the db tests + if 'db' in item.keywords: + pattern = item.config.getoption('-m') + markers = collections.defaultdict(bool) + for marker in item.iter_markers(): + markers[marker.name] = True + markers['db'] = False + db_in_pattern = not eval(pattern, {}, markers) + if not db_in_pattern: + pytest.skip('skipping db unless -m "db" is specified') + # Configurations for all tests and all test modules diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index a6f603d16affec..6b7199c019c481 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -15,7 +15,7 @@ from pandas.compat.numpy import function as nv from pandas.errors import ( AbstractMethodError, NullFrequencyError, PerformanceWarning) -from pandas.util._decorators import Appender, Substitution, deprecate_kwarg +from pandas.util._decorators import Appender, Substitution from pandas.core.dtypes.common import ( is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, @@ -27,13 +27,15 @@ from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries from pandas.core.dtypes.missing import isna -from pandas.core.algorithms import checked_add_with_arr, take, unique1d +from pandas.core import nanops +from pandas.core.algorithms import ( + checked_add_with_arr, take, unique1d, value_counts) import pandas.core.common as com from pandas.tseries import frequencies from pandas.tseries.offsets import DateOffset, Tick -from .base import ExtensionOpsMixin +from .base import ExtensionArray, ExtensionOpsMixin def _make_comparison_op(cls, op): @@ -342,7 +344,9 @@ def ceil(self, freq, ambiguous='raise', nonexistent='raise'): return self._round(freq, RoundTo.PLUS_INFTY, ambiguous, nonexistent) -class DatetimeLikeArrayMixin(ExtensionOpsMixin, AttributesMixin): +class DatetimeLikeArrayMixin(ExtensionOpsMixin, + AttributesMixin, + ExtensionArray): """ Shared Base/Mixin class for DatetimeArray, TimedeltaArray, PeriodArray @@ -698,7 +702,44 @@ def repeat(self, repeats, *args, **kwargs): """ nv.validate_repeat(args, kwargs) values = self._data.repeat(repeats) - return type(self)(values, dtype=self.dtype) + return type(self)(values.view('i8'), dtype=self.dtype) + + def value_counts(self, dropna=False): + """ + Return a Series containing counts of unique values. + + Parameters + ---------- + dropna : boolean, default True + Don't include counts of NaT values. + + Returns + ------- + Series + """ + from pandas import Series, Index + + if dropna: + values = self[~self.isna()]._data + else: + values = self._data + + cls = type(self) + + result = value_counts(values, sort=False, dropna=dropna) + index = Index(cls(result.index.view('i8'), dtype=self.dtype), + name=result.index.name) + return Series(result.values, index=index, name=result.name) + + def map(self, mapper): + # TODO(GH-23179): Add ExtensionArray.map + # Need to figure out if we want ExtensionArray.map first. + # If so, then we can refactor IndexOpsMixin._map_values to + # a standalone function and call from here.. + # Else, just rewrite _map_infer_values to do the right thing. + from pandas import Index + + return Index(self).map(mapper).array # ------------------------------------------------------------------ # Null Handling @@ -1077,39 +1118,6 @@ def _addsub_offset_array(self, other, op): return type(self)(res_values, freq='infer') return self._from_sequence(res_values) - @deprecate_kwarg(old_arg_name='n', new_arg_name='periods') - def shift(self, periods, freq=None): - """ - Shift index by desired number of time frequency increments. - - This method is for shifting the values of datetime-like indexes - by a specified time increment a given number of times. - - Parameters - ---------- - periods : int - Number of periods (or increments) to shift by, - can be positive or negative. - - .. versionchanged:: 0.24.0 - - freq : pandas.DateOffset, pandas.Timedelta or string, optional - Frequency increment to shift by. - If None, the index is shifted by its own `freq` attribute. - Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc. - - Returns - ------- - pandas.DatetimeIndex - Shifted index. - - See Also - -------- - Index.shift : Shift values of Index. - PeriodIndex.shift : Shift values of PeriodIndex. - """ - return self._time_shift(periods=periods, freq=freq) - def _time_shift(self, periods, freq=None): """ Shift each value by `periods`. @@ -1381,6 +1389,70 @@ def _ensure_localized(self, arg, ambiguous='raise', nonexistent='raise', ) return arg + # -------------------------------------------------------------- + # Reductions + + def _reduce(self, name, axis=0, skipna=True, **kwargs): + op = getattr(self, name, None) + if op: + return op(axis=axis, skipna=skipna, **kwargs) + else: + return super(DatetimeLikeArrayMixin, self)._reduce( + name, skipna, **kwargs + ) + + def min(self, axis=None, skipna=True, *args, **kwargs): + """ + Return the minimum value of the Array or minimum along + an axis. + + See Also + -------- + numpy.ndarray.min + Index.min : Return the minimum value in an Index. + Series.min : Return the minimum value in a Series. + """ + nv.validate_min(args, kwargs) + nv.validate_minmax_axis(axis) + + result = nanops.nanmin(self.asi8, skipna=skipna, mask=self.isna()) + if isna(result): + # Period._from_ordinal does not handle np.nan gracefully + return NaT + return self._box_func(result) + + def max(self, axis=None, skipna=True, *args, **kwargs): + """ + Return the maximum value of the Array or maximum along + an axis. + + See Also + -------- + numpy.ndarray.max + Index.max : Return the maximum value in an Index. + Series.max : Return the maximum value in a Series. + """ + # TODO: skipna is broken with max. + # See https://github.com/pandas-dev/pandas/issues/24265 + nv.validate_max(args, kwargs) + nv.validate_minmax_axis(axis) + + mask = self.isna() + if skipna: + values = self[~mask].asi8 + elif mask.any(): + return NaT + else: + values = self.asi8 + + if not len(values): + # short-circut for empty max / min + return NaT + + result = nanops.nanmax(values, skipna=skipna) + # Don't have to worry about NA `result`, since no NA went in. + return self._box_func(result) + DatetimeLikeArrayMixin._add_comparison_ops() diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 5ff244b5fd7ae7..9827c111e0fd27 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -22,7 +22,7 @@ from pandas.core.dtypes.missing import isna, notna import pandas.core.algorithms as algos -from pandas.core.arrays import ExtensionArray, datetimelike as dtl +from pandas.core.arrays import datetimelike as dtl import pandas.core.common as com from pandas.core.missing import backfill_1d, pad_1d @@ -92,9 +92,7 @@ def wrapper(self, other): return compat.set_function_name(wrapper, opname, cls) -class PeriodArray(dtl.DatetimeLikeArrayMixin, - dtl.DatelikeOps, - ExtensionArray): +class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): """ Pandas ExtensionArray for storing Period data. @@ -418,50 +416,8 @@ def fillna(self, value=None, method=None, limit=None): new_values = self.copy() return new_values - def value_counts(self, dropna=False): - from pandas import Series, PeriodIndex - - if dropna: - values = self[~self.isna()]._data - else: - values = self._data - - cls = type(self) - - result = algos.value_counts(values, sort=False) - index = PeriodIndex(cls(result.index, freq=self.freq), - name=result.index.name) - return Series(result.values, index=index, name=result.name) - # -------------------------------------------------------------------- - def shift(self, periods=1, fill_value=None): - """ - Shift values by desired number. - - Newly introduced missing values are filled with - ``self.dtype.na_value``. - - .. versionadded:: 0.24.0 - - Parameters - ---------- - periods : int, default 1 - The number of periods to shift. Negative values are allowed - for shifting backwards. - fill_value : optional, default NaT - - .. versionadded:: 0.24.0 - - Returns - ------- - shifted : PeriodArray - """ - # TODO(DatetimeArray): remove - # The semantics for Index.shift differ from EA.shift - # then just call super. - return ExtensionArray.shift(self, periods, fill_value=fill_value) - def _time_shift(self, n, freq=None): """ Shift each value by `periods`. diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 3611e3696e3906..719a79cf300a01 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -16,7 +16,7 @@ from pandas.core.dtypes.common import ( _NS_DTYPE, _TD_DTYPE, ensure_int64, is_datetime64_dtype, is_float_dtype, - is_integer_dtype, is_list_like, is_object_dtype, is_scalar, + is_int64_dtype, is_integer_dtype, is_list_like, is_object_dtype, is_scalar, is_string_dtype, is_timedelta64_dtype, is_timedelta64_ns_dtype, pandas_dtype) from pandas.core.dtypes.dtypes import DatetimeTZDtype @@ -244,6 +244,16 @@ def _maybe_clear_freq(self): # ---------------------------------------------------------------- # Array-Like / EA-Interface Methods + def __array__(self, dtype=None): + # TODO(https://github.com/pandas-dev/pandas/pull/23593) + # Maybe push to parent once datetimetz __array__ is figured out. + if is_object_dtype(dtype): + return np.array(list(self), dtype=object) + elif is_int64_dtype(dtype): + return self.asi8 + + return self._data + @Appender(dtl.DatetimeLikeArrayMixin._validate_fill_value.__doc__) def _validate_fill_value(self, fill_value): if isna(fill_value): diff --git a/pandas/core/computation/check.py b/pandas/core/computation/check.py index d2d5e018063ff1..da89bde56fe18b 100644 --- a/pandas/core/computation/check.py +++ b/pandas/core/computation/check.py @@ -3,11 +3,13 @@ _NUMEXPR_INSTALLED = False _MIN_NUMEXPR_VERSION = "2.6.1" +_NUMEXPR_VERSION = None try: import numexpr as ne ver = LooseVersion(ne.__version__) _NUMEXPR_INSTALLED = ver >= LooseVersion(_MIN_NUMEXPR_VERSION) + _NUMEXPR_VERSION = ver if not _NUMEXPR_INSTALLED: warnings.warn( @@ -19,4 +21,4 @@ except ImportError: # pragma: no cover pass -__all__ = ['_NUMEXPR_INSTALLED'] +__all__ = ['_NUMEXPR_INSTALLED', '_NUMEXPR_VERSION'] diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index cbdb3525d5e88d..8c3218a976b6b6 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -2,6 +2,7 @@ """ from datetime import datetime +from distutils.version import LooseVersion from functools import partial import operator as op @@ -23,8 +24,11 @@ _unary_math_ops = ('sin', 'cos', 'exp', 'log', 'expm1', 'log1p', 'sqrt', 'sinh', 'cosh', 'tanh', 'arcsin', 'arccos', - 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs', 'log10') + 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs', 'log10', + 'floor', 'ceil' + ) _binary_math_ops = ('arctan2',) + _mathops = _unary_math_ops + _binary_math_ops @@ -539,11 +543,17 @@ def __unicode__(self): class FuncNode(object): - def __init__(self, name): - if name not in _mathops: + from pandas.core.computation.check import (_NUMEXPR_INSTALLED, + _NUMEXPR_VERSION) + if name not in _mathops or ( + _NUMEXPR_INSTALLED and + _NUMEXPR_VERSION < LooseVersion('2.6.9') and + name in ('floor', 'ceil') + ): raise ValueError( "\"{0}\" is not a supported function".format(name)) + self.name = name self.func = getattr(np, name) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index a34a34186cf45f..99ae551d3c55b9 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -7291,7 +7291,7 @@ def f(x): if filter_type is None or filter_type == 'numeric': data = self._get_numeric_data() elif filter_type == 'bool': - data = self._get_bool_data() + data = self else: # pragma: no cover msg = ("Generating numeric_only data with filter_type {f}" "not supported.".format(f=filter_type)) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 60b6c843492c71..b8b73b6aab1a5d 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -759,7 +759,7 @@ def _try_cast(self, result, obj, numeric_only=False): """ if obj.ndim > 1: - dtype = obj.values.dtype + dtype = obj._values.dtype else: dtype = obj.dtype @@ -768,7 +768,7 @@ def _try_cast(self, result, obj, numeric_only=False): # The function can return something of any type, so check # if the type is compatible with the calling EA. try: - result = obj.values._from_sequence(result) + result = obj._values._from_sequence(result, dtype=dtype) except Exception: # https://github.com/pandas-dev/pandas/issues/22850 # pandas has no control over what 3rd-party ExtensionArrays @@ -1334,7 +1334,7 @@ def resample(self, rule, *args, **kwargs): Given a grouper, the function resamples it according to a string "string" -> "frequency". - See the :ref:`frequency aliases ` + See the :ref:`frequency aliases ` documentation for more details. Parameters diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 36bf4ba5d98511..07aec6a0d833f3 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -602,36 +602,6 @@ def _shallow_copy_with_infer(self, values, **kwargs): pass return Index(values, **attributes) - def _deepcopy_if_needed(self, orig, copy=False): - """ - Make a copy of self if data coincides (in memory) with orig. - Subclasses should override this if self._base is not an ndarray. - - .. versionadded:: 0.19.0 - - Parameters - ---------- - orig : ndarray - other ndarray to compare self._data against - copy : boolean, default False - when False, do not run any check, just return self - - Returns - ------- - A copy of self if needed, otherwise self : Index - """ - if copy: - # Retrieve the "base objects", i.e. the original memory allocations - if not isinstance(orig, np.ndarray): - # orig is a DatetimeIndex - orig = orig.values - orig = orig if orig.base is None else orig.base - new = self._data if self._data.base is None else self._data.base - if orig is new: - return self.copy(deep=True) - - return self - def _update_inplace(self, result, **kwargs): # guard when called from IndexOpsMixin raise TypeError("Index can't be updated inplace") diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index d090d0e7d9caa4..3b6e10de1f4ff6 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -603,9 +603,37 @@ def _time_shift(self, periods, freq=None): return type(self)(result, name=self.name) @deprecate_kwarg(old_arg_name='n', new_arg_name='periods') - @Appender(DatetimeLikeArrayMixin.shift.__doc__) def shift(self, periods, freq=None): - result = self._eadata.shift(periods, freq=freq) + """ + Shift index by desired number of time frequency increments. + + This method is for shifting the values of datetime-like indexes + by a specified time increment a given number of times. + + Parameters + ---------- + periods : int + Number of periods (or increments) to shift by, + can be positive or negative. + + .. versionchanged:: 0.24.0 + + freq : pandas.DateOffset, pandas.Timedelta or string, optional + Frequency increment to shift by. + If None, the index is shifted by its own `freq` attribute. + Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc. + + Returns + ------- + pandas.DatetimeIndex + Shifted index. + + See Also + -------- + Index.shift : Shift values of Index. + PeriodIndex.shift : Shift values of PeriodIndex. + """ + result = self._eadata._time_shift(periods, freq=freq) return type(self)(result, name=self.name) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index a8651a25eef6b2..ffee263c0bedc0 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -299,12 +299,6 @@ def __new__(cls, data=None, # - Cases checked above all return/raise before reaching here - # - # This allows to later ensure that the 'copy' parameter is honored: - if isinstance(data, Index): - ref_to_data = data._data - else: - ref_to_data = data - if name is None and hasattr(data, 'name'): name = data.name @@ -314,8 +308,7 @@ def __new__(cls, data=None, subarr = cls._simple_new(dtarr._data, name=name, freq=dtarr.freq, tz=dtarr.tz) - - return subarr._deepcopy_if_needed(ref_to_data, copy) + return subarr @classmethod def _simple_new(cls, values, name=None, freq=None, tz=None, dtype=None): diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index de0ed9407e1610..af390313785555 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -261,7 +261,7 @@ whether or not to interpret two consecutive quotechar elements INSIDE a field as a single ``quotechar`` element. escapechar : str (length 1), optional - One-character string used to escape delimiter when quoting is QUOTE_NONE. + One-character string used to escape other characters. comment : str, optional Indicates remainder of line should not be parsed. If found at the beginning of a line, the line will be ignored altogether. This parameter must be a diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 44817467b46941..d4e82fe2659a03 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1596,6 +1596,8 @@ def check(get_ser, test_ser): # with 'operate' (from core/ops.py) for the ops that are not # defined op = getattr(get_ser, op_str, None) + # Previously, _validate_for_numeric_binop in core/indexes/base.py + # did this for us. with pytest.raises(TypeError, match='operate|[cC]annot|unsupported operand'): op(test_ser) diff --git a/pandas/tests/arrays/test_datetimelike.py b/pandas/tests/arrays/test_datetimelike.py index 2b071182a664d6..9ef331be324173 100644 --- a/pandas/tests/arrays/test_datetimelike.py +++ b/pandas/tests/arrays/test_datetimelike.py @@ -157,6 +157,13 @@ def test_scalar_from_string(self): result = arr._scalar_from_string(str(arr[0])) assert result == arr[0] + def test_reduce_invalid(self): + data = np.arange(10, dtype='i8') * 24 * 3600 * 10**9 + arr = self.array_cls(data, freq='D') + + with pytest.raises(TypeError, match='cannot perform'): + arr._reduce("not a method") + def test_searchsorted(self): data = np.arange(10, dtype='i8') * 24 * 3600 * 10**9 arr = self.array_cls(data, freq='D') diff --git a/pandas/tests/arrays/test_datetimes.py b/pandas/tests/arrays/test_datetimes.py index 035c1a939a8af0..9f0954d328f893 100644 --- a/pandas/tests/arrays/test_datetimes.py +++ b/pandas/tests/arrays/test_datetimes.py @@ -113,6 +113,31 @@ def test_setitem_clears_freq(self): a[0] = pd.Timestamp("2000", tz="US/Central") assert a.freq is None + def test_repeat_preserves_tz(self): + dti = pd.date_range('2000', periods=2, freq='D', tz='US/Central') + arr = DatetimeArray(dti) + + repeated = arr.repeat([1, 1]) + + # preserves tz and values, but not freq + expected = DatetimeArray(arr.asi8, freq=None, tz=arr.tz) + tm.assert_equal(repeated, expected) + + def test_value_counts_preserves_tz(self): + dti = pd.date_range('2000', periods=2, freq='D', tz='US/Central') + arr = DatetimeArray(dti).repeat([4, 3]) + + result = arr.value_counts() + + # Note: not tm.assert_index_equal, since `freq`s do not match + assert result.index.equals(dti) + + arr[-2] = pd.NaT + result = arr.value_counts() + expected = pd.Series([1, 4, 2], + index=[pd.NaT, dti[0], dti[1]]) + tm.assert_series_equal(result, expected) + class TestSequenceToDT64NS(object): @@ -126,3 +151,41 @@ def test_tz_dtype_matches(self): result, _, _ = sequence_to_dt64ns( arr, dtype=DatetimeTZDtype(tz="US/Central")) tm.assert_numpy_array_equal(arr._data, result) + + +class TestReductions(object): + + @pytest.mark.parametrize("tz", [None, "US/Central"]) + def test_min_max(self, tz): + arr = DatetimeArray._from_sequence([ + '2000-01-03', + '2000-01-03', + 'NaT', + '2000-01-02', + '2000-01-05', + '2000-01-04', + ], tz=tz) + + result = arr.min() + expected = pd.Timestamp('2000-01-02', tz=tz) + assert result == expected + + result = arr.max() + expected = pd.Timestamp('2000-01-05', tz=tz) + assert result == expected + + result = arr.min(skipna=False) + assert result is pd.NaT + + result = arr.max(skipna=False) + assert result is pd.NaT + + @pytest.mark.parametrize("tz", [None, "US/Central"]) + @pytest.mark.parametrize('skipna', [True, False]) + def test_min_max_empty(self, skipna, tz): + arr = DatetimeArray._from_sequence([], tz=tz) + result = arr.min(skipna=skipna) + assert result is pd.NaT + + result = arr.max(skipna=skipna) + assert result is pd.NaT diff --git a/pandas/tests/arrays/test_period.py b/pandas/tests/arrays/test_period.py index 82025cd972e6b9..387eaa5223bbee 100644 --- a/pandas/tests/arrays/test_period.py +++ b/pandas/tests/arrays/test_period.py @@ -261,3 +261,42 @@ def test_repr_large(): "Length: 1000, dtype: period[D]" ) assert result == expected + + +# ---------------------------------------------------------------------------- +# Reductions + +class TestReductions(object): + + def test_min_max(self): + arr = period_array([ + '2000-01-03', + '2000-01-03', + 'NaT', + '2000-01-02', + '2000-01-05', + '2000-01-04', + ], freq='D') + + result = arr.min() + expected = pd.Period('2000-01-02', freq='D') + assert result == expected + + result = arr.max() + expected = pd.Period('2000-01-05', freq='D') + assert result == expected + + result = arr.min(skipna=False) + assert result is pd.NaT + + result = arr.max(skipna=False) + assert result is pd.NaT + + @pytest.mark.parametrize('skipna', [True, False]) + def test_min_max_empty(self, skipna): + arr = period_array([], freq='D') + result = arr.min(skipna=skipna) + assert result is pd.NaT + + result = arr.max(skipna=skipna) + assert result is pd.NaT diff --git a/pandas/tests/arrays/test_timedeltas.py b/pandas/tests/arrays/test_timedeltas.py index 541af3985f5eed..1221d920f2e913 100644 --- a/pandas/tests/arrays/test_timedeltas.py +++ b/pandas/tests/arrays/test_timedeltas.py @@ -93,3 +93,34 @@ def test_setitem_clears_freq(self): a = TimedeltaArray(pd.timedelta_range('1H', periods=2, freq='H')) a[0] = pd.Timedelta("1H") assert a.freq is None + + +class TestReductions(object): + + def test_min_max(self): + arr = TimedeltaArray._from_sequence([ + '3H', '3H', 'NaT', '2H', '5H', '4H', + ]) + + result = arr.min() + expected = pd.Timedelta('2H') + assert result == expected + + result = arr.max() + expected = pd.Timedelta('5H') + assert result == expected + + result = arr.min(skipna=False) + assert result is pd.NaT + + result = arr.max(skipna=False) + assert result is pd.NaT + + @pytest.mark.parametrize('skipna', [True, False]) + def test_min_max_empty(self, skipna): + arr = TimedeltaArray._from_sequence([]) + result = arr.min(skipna=skipna) + assert result is pd.NaT + + result = arr.max(skipna=skipna) + assert result is pd.NaT diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 52945edb14e587..1649c99384ef20 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -1,5 +1,6 @@ import warnings import operator +from distutils.version import LooseVersion from itertools import product import pytest @@ -14,6 +15,7 @@ from pandas.util.testing import makeCustomDataframe as mkdf from pandas.core.computation import pytables +from pandas.core.computation.check import _NUMEXPR_VERSION from pandas.core.computation.engines import _engines, NumExprClobberingError from pandas.core.computation.expr import PythonExprVisitor, PandasExprVisitor from pandas.core.computation.expressions import ( @@ -32,6 +34,7 @@ assert_produces_warning) from pandas.compat import PY3, reduce + _series_frame_incompatible = _bool_ops_syms _scalar_skip = 'in', 'not in' @@ -54,6 +57,25 @@ def parser(request): return request.param +@pytest.fixture +def ne_lt_2_6_9(): + if _NUMEXPR_INSTALLED and _NUMEXPR_VERSION >= LooseVersion('2.6.9'): + pytest.skip("numexpr is >= 2.6.9") + return 'numexpr' + + +@pytest.fixture +def unary_fns_for_ne(): + if _NUMEXPR_INSTALLED: + if _NUMEXPR_VERSION >= LooseVersion('2.6.9'): + return _unary_math_ops + else: + return tuple(x for x in _unary_math_ops + if x not in ("floor", "ceil")) + else: + pytest.skip("numexpr is not present") + + def engine_has_neg_frac(engine): return _engines[engine].has_neg_frac @@ -1622,16 +1644,26 @@ def eval(self, *args, **kwargs): kwargs['level'] = kwargs.pop('level', 0) + 1 return pd.eval(*args, **kwargs) - def test_unary_functions(self): + def test_unary_functions(self, unary_fns_for_ne): df = DataFrame({'a': np.random.randn(10)}) a = df.a - for fn in self.unary_fns: + + for fn in unary_fns_for_ne: expr = "{0}(a)".format(fn) got = self.eval(expr) with np.errstate(all='ignore'): expect = getattr(np, fn)(a) tm.assert_series_equal(got, expect, check_names=False) + def test_floor_and_ceil_functions_raise_error(self, + ne_lt_2_6_9, + unary_fns_for_ne): + for fn in ('floor', 'ceil'): + msg = "\"{0}\" is not a supported function".format(fn) + with pytest.raises(ValueError, match=msg): + expr = "{0}(100)".format(fn) + self.eval(expr) + def test_binary_functions(self): df = DataFrame({'a': np.random.randn(10), 'b': np.random.randn(10)}) diff --git a/pandas/tests/frame/test_analytics.py b/pandas/tests/frame/test_analytics.py index 6f68828b94a848..73ea2c679913ca 100644 --- a/pandas/tests/frame/test_analytics.py +++ b/pandas/tests/frame/test_analytics.py @@ -228,13 +228,6 @@ def assert_bool_op_api(opname, bool_frame_with_na, float_string_frame, getattr(mixed, opname)(axis=0) getattr(mixed, opname)(axis=1) - class NonzeroFail(object): - - def __nonzero__(self): - raise ValueError - - mixed['_nonzero_fail_'] = NonzeroFail() - if has_bool_only: getattr(mixed, opname)(axis=0, bool_only=True) getattr(mixed, opname)(axis=1, bool_only=True) @@ -1374,25 +1367,22 @@ def test_any_all_extra(self): result = df[['C']].all(axis=None).item() assert result is True - # skip pathological failure cases - # class CantNonzero(object): - - # def __nonzero__(self): - # raise ValueError + def test_any_datetime(self): - # df[4] = CantNonzero() - - # it works! - # df.any(1) - # df.all(1) - # df.any(1, bool_only=True) - # df.all(1, bool_only=True) + # GH 23070 + float_data = [1, np.nan, 3, np.nan] + datetime_data = [pd.Timestamp('1960-02-15'), + pd.Timestamp('1960-02-16'), + pd.NaT, + pd.NaT] + df = DataFrame({ + "A": float_data, + "B": datetime_data + }) - # df[4][4] = np.nan - # df.any(1) - # df.all(1) - # df.any(1, bool_only=True) - # df.all(1, bool_only=True) + result = df.any(1) + expected = Series([True, True, True, False]) + tm.assert_series_equal(result, expected) @pytest.mark.parametrize('func, data, expected', [ (np.any, {}, False), diff --git a/pandas/tests/indexes/datetimes/test_datetime.py b/pandas/tests/indexes/datetimes/test_datetime.py index c3380260257677..e76de2ebedf67f 100644 --- a/pandas/tests/indexes/datetimes/test_datetime.py +++ b/pandas/tests/indexes/datetimes/test_datetime.py @@ -1,5 +1,4 @@ from datetime import date -import sys import dateutil import numpy as np @@ -125,15 +124,14 @@ def test_map(self): exp = Index([f(x) for x in rng], dtype='=3.58 to run tests") - cmd = ['--skip-slow', '--skip-network', '--skip-db'] + cmd = ['--skip-slow', '--skip-network'] if extra_args: if not isinstance(extra_args, list): extra_args = [extra_args] diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 171d4d1ffcb39c..91e3c6d64990b0 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -684,52 +684,6 @@ def wrapper(*args, **kwargs): return wrapper -def capture_stderr(f): - r""" - Decorator to capture stderr in a buffer so that it can be checked - (or suppressed) during testing. - - Parameters - ---------- - f : callable - The test that is capturing stderr. - - Returns - ------- - f : callable - The decorated test ``f``, which captures stderr. - - Examples - -------- - - >>> from pandas.util.testing import capture_stderr - >>> import sys - >>> - >>> @capture_stderr - ... def test_stderr_pass(): - ... sys.stderr.write("foo") - ... out = sys.stderr.getvalue() - ... assert out == "foo\n" - >>> - >>> @capture_stderr - ... def test_stderr_fail(): - ... sys.stderr.write("foo") - ... out = sys.stderr.getvalue() - ... assert out == "bar\n" - ... - AssertionError: assert 'foo\n' == 'bar\n' - """ - - @compat.wraps(f) - def wrapper(*args, **kwargs): - try: - sys.stderr = StringIO() - f(*args, **kwargs) - finally: - sys.stderr = sys.__stderr__ - - return wrapper - # ----------------------------------------------------------------------------- # Console debugging tools diff --git a/scripts/tests/test_validate_docstrings.py b/scripts/tests/test_validate_docstrings.py index ca09cbb23d145d..3d16fecb4ec3c3 100644 --- a/scripts/tests/test_validate_docstrings.py +++ b/scripts/tests/test_validate_docstrings.py @@ -4,7 +4,6 @@ import textwrap import pytest import numpy as np -from pandas.util.testing import capture_stderr import validate_docstrings validate_one = validate_docstrings.validate_one @@ -739,36 +738,32 @@ def _import_path(self, klass=None, func=None): return base_path - @capture_stderr - def test_good_class(self): + def test_good_class(self, capsys): errors = validate_one(self._import_path( klass='GoodDocStrings'))['errors'] assert isinstance(errors, list) assert not errors - @capture_stderr @pytest.mark.parametrize("func", [ 'plot', 'sample', 'random_letters', 'sample_values', 'head', 'head1', 'contains', 'mode', 'good_imports']) - def test_good_functions(self, func): + def test_good_functions(self, capsys, func): errors = validate_one(self._import_path( klass='GoodDocStrings', func=func))['errors'] assert isinstance(errors, list) assert not errors - @capture_stderr - def test_bad_class(self): + def test_bad_class(self, capsys): errors = validate_one(self._import_path( klass='BadGenericDocStrings'))['errors'] assert isinstance(errors, list) assert errors - @capture_stderr @pytest.mark.parametrize("func", [ 'func', 'astype', 'astype1', 'astype2', 'astype3', 'plot', 'method', 'private_classes', ]) - def test_bad_generic_functions(self, func): + def test_bad_generic_functions(self, capsys, func): errors = validate_one(self._import_path( # noqa:F821 klass='BadGenericDocStrings', func=func))['errors'] assert isinstance(errors, list) diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index 2baac5f2c7e31e..bfc52a0de918be 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -17,6 +17,7 @@ import sys import json import re +import glob import functools import collections import argparse @@ -776,9 +777,11 @@ def validate_all(prefix, ignore_deprecated=False): seen = {} # functions from the API docs - api_doc_fname = os.path.join(BASE_PATH, 'doc', 'source', 'api.rst') - with open(api_doc_fname) as f: - api_items = list(get_api_items(f)) + api_doc_fnames = os.path.join(BASE_PATH, 'doc', 'source', 'api', '*.rst') + api_items = [] + for api_doc_fname in glob.glob(api_doc_fnames): + with open(api_doc_fname) as f: + api_items += list(get_api_items(f)) for func_name, func_obj, section, subsection in api_items: if prefix and not func_name.startswith(prefix): continue