diff --git a/doc/source/api.rst b/doc/source/api.rst index 2e59bf6533205..fea8b95bb2bcf 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -38,9 +38,8 @@ Pickling load save -File IO -~~~~~~~ - +Flat File IO +^^^^^^^^^^^^ .. currentmodule:: pandas.io.parsers .. autosummary:: @@ -62,9 +61,13 @@ File IO :toctree: generated/ read_stata + read_fwf + read_clipboard .. currentmodule:: pandas.io.html +HTML IO +^^^^^^^ .. autosummary:: :toctree: generated/ @@ -80,6 +83,46 @@ SQL read_sql +Excel IO +^^^^^^^^ +.. currentmodule:: pandas.io.parsers + +.. autosummary:: + :toctree: generated/ + + ExcelFile.parse + +SQL IO +^^^^^^ +.. currentmodule:: pandas.io.sql + +.. autosummary:: + :toctree: generated/ + + read_frame + write_frame + +.. currentmodule:: pandas.io + +.. autosummary:: + :toctree: generated/ + + sql + +STATA IO +^^^^^^^^ +.. currentmodule:: pandas.io.stata + +.. autosummary:: + :toctree: generated/ + + read_stata + StataReader.data + StataReader.data_label + StataReader.value_labels + StataReader.variable_labels + StataWriter.write_file + HDFStore: PyTables (HDF5) ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -94,6 +137,17 @@ HDFStore: PyTables (HDF5) HDFStore.get HDFStore.select +Top-level Missing Data +~~~~~~~~~~~~~~~~~~~~~~ + +.. currentmodule:: pandas.core.common + +.. autosummary:: + :toctree: generated/ + + isnull + notnull + Standard moving window functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/source/io.rst b/doc/source/io.rst index 5bf3075f2688e..a8d5cf4ab2f60 100644 --- a/doc/source/io.rst +++ b/doc/source/io.rst @@ -667,9 +667,9 @@ should pass the ``escapechar`` option: Files with Fixed Width Columns ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -While `read_csv` reads delimited data, the :func:`~pandas.io.parsers.read_fwf` +While ``read_csv`` reads delimited data, the :func:`~pandas.io.parsers.read_fwf` function works with data files that have known and fixed column widths. -The function parameters to `read_fwf` are largely the same as `read_csv` with +The function parameters to ``read_fwf`` are largely the same as `read_csv` with two extra parameters: - ``colspecs``: a list of pairs (tuples), giving the extents of the @@ -2123,23 +2123,30 @@ Writing to STATA format .. _io.StataWriter: -The method ``to_stata`` will write a DataFrame into a .dta file. +The method :func:`~pandas.io.stata.StataWriter.write_file` of +:class:`~pandas.io.stata.StataWriter` will write a DataFrame into a .dta file. The format version of this file is always the latest one, 115. .. ipython:: python - df = DataFrame(randn(10,2),columns=list('AB')) - df.to_stata('stata.dta') + from pandas.io.stata import StataWriter + df = DataFrame(randn(10, 2), columns=list('AB')) + writer = StataWriter('stata.dta', df) + writer.write_file() Reading from STATA format ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. _io.StataReader: +.. _io.statareader: .. versionadded:: 0.11.1 The top-level function ``read_stata`` will read a dta format file and return a DataFrame: +The class :class:`~pandas.io.stata.StataReader` will read the header of the +given dta file at initialization. Its method +:func:`~pandas.io.stata.StataReader.data` will read the observations, +converting them to a DataFrame which is returned: .. ipython:: python @@ -2153,6 +2160,7 @@ also be retrieved by the function ``variable_labels``, which requires data to be called before (see ``pandas.io.stata.StataReader``). The StataReader supports .dta Formats 104, 105, 108, 113-115. +Alternatively, the function :func:`~pandas.io.stata.read_stata` can be used .. ipython:: python :suppress: diff --git a/pandas/core/common.py b/pandas/core/common.py index ee8b3bbbda647..994a57247e50b 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -48,17 +48,19 @@ class AmbiguousIndexError(PandasError, KeyError): _INT64_DTYPE = np.dtype(np.int64) def isnull(obj): - ''' - Detect missing values (NaN in numeric arrays, None/NaN in object arrays) + """Detect missing values (NaN in numeric arrays, None/NaN in object arrays) Parameters ---------- - arr: ndarray or object value + arr : ndarray or object value + Object to check for null-ness Returns ------- - boolean ndarray or boolean - ''' + isnulled : array-like of bool or bool + Array or bool indicating whether an object is null or if an array is + given which of the element is null. + """ return _isnull(obj) @@ -187,18 +189,20 @@ def _isnull_ndarraylike_old(obj): def notnull(obj): - ''' - Replacement for numpy.isfinite / -numpy.isnan which is suitable - for use on object arrays. + """Replacement for numpy.isfinite / -numpy.isnan which is suitable for use + on object arrays. Parameters ---------- - arr: ndarray or object value + arr : ndarray or object value + Object to check for *not*-null-ness Returns ------- - boolean ndarray or boolean - ''' + isnulled : array-like of bool or bool + Array or bool indicating whether an object is *not* null or if an array + is given which of the element is *not* null. + """ res = isnull(obj) if np.isscalar(res): return not res diff --git a/pandas/io/__init__.py b/pandas/io/__init__.py index e69de29bb2d1d..a984c40cdc098 100644 --- a/pandas/io/__init__.py +++ b/pandas/io/__init__.py @@ -0,0 +1,2 @@ +import sql +import stata