Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 57 additions & 3 deletions doc/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ Pickling
load
save

File IO
~~~~~~~

Flat File IO
^^^^^^^^^^^^
.. currentmodule:: pandas.io.parsers

.. autosummary::
Expand All @@ -62,9 +61,13 @@ File IO
:toctree: generated/

read_stata
read_fwf
read_clipboard

.. currentmodule:: pandas.io.html

HTML IO
^^^^^^^
.. autosummary::
:toctree: generated/

Expand All @@ -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)
~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
20 changes: 14 additions & 6 deletions doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand Down
26 changes: 15 additions & 11 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import sql
import stata