Skip to content

Commit de1b535

Browse files
committed
DOC: minor io.rst edits
1 parent f4bd142 commit de1b535

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

doc/source/indexing.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ attention in this area. Expect more work to be invested higher-dimensional data
3232
structures (including Panel) in the future, especially in label-based advanced
3333
indexing.
3434

35-
.. note::
35+
.. note::
3636

3737
The Python and NumPy indexing operators ``[]`` and attribute operator ``.`` provide quick and easy access to pandas data structures
3838
across a wide range of use cases. This makes interactive work intuitive, as
@@ -43,7 +43,7 @@ indexing.
4343
that you take advantage of the optimized pandas data access methods exposed in this chapter.
4444

4545
In addition, whether a copy or a reference is returned for a selection operation, may depend on the context.
46-
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`
46+
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`
4747

4848
See the :ref:`cookbook<cookbook.selection>` for some advanced strategies
4949

@@ -69,7 +69,7 @@ three types of multi-axis indexing.
6969
- A list or array of integers ``[4, 3, 0]``
7070
- A slice object with ints ``1:7``
7171

72-
See more at :ref:`Selection by Position <indexing.integer>`
72+
See more at :ref:`Selection by Position <indexing.integer>`
7373

7474
- ``.ix`` supports mixed integer and label based access. It is primarily label based, but will fallback to integer positional access. ``.ix`` is the most general
7575
and will support any of the inputs to ``.loc`` and ``.iloc``, as well as support for floating point label schemes. ``.ix`` is especially useful when dealing with mixed positional and label
@@ -449,7 +449,7 @@ more complex criteria:
449449
# Multiple criteria
450450
df2[criterion & (df2['b'] == 'x')]
451451
452-
Note, with the choice methods :ref:`Selection by Label <indexing.label>`, :ref:`Selection by Position <indexing.integer>`,
452+
Note, with the choice methods :ref:`Selection by Label <indexing.label>`, :ref:`Selection by Position <indexing.integer>`,
453453
and :ref:`Advanced Indexing <indexing.advanced>` you may select along more than one axis using boolean vectors combined with other indexing expressions.
454454

455455
.. ipython:: python
@@ -503,7 +503,7 @@ This can be done intuitively like so:
503503
df2[df2 < 0] = 0
504504
df2
505505
506-
Furthermore, ``where`` aligns the input boolean condition (ndarray or DataFrame),
506+
Furthermore, ``where`` aligns the input boolean condition (ndarray or DataFrame),
507507
such that partial selection with setting is possible. This is analagous to
508508
partial setting via ``.ix`` (but on the contents rather than the axis labels)
509509

@@ -513,7 +513,7 @@ partial setting via ``.ix`` (but on the contents rather than the axis labels)
513513
df2[ df2[1:4] > 0 ] = 3
514514
df2
515515
516-
By default, ``where`` returns a modified copy of the data. There is an
516+
By default, ``where`` returns a modified copy of the data. There is an
517517
optional parameter ``inplace`` so that the original data can be modified
518518
without creating a copy:
519519

@@ -788,35 +788,35 @@ In chained expressions, the order may determine whether a copy is returned or no
788788
dfb[dfb.a.str.startswith('o')]['c'] = 42 # goes to copy (will be lost)
789789
dfb['c'][dfb.a.str.startswith('o')] = 42 # passed via reference (will stay)
790790
791-
When assigning values to subsets of your data, thus, make sure to either use the
791+
When assigning values to subsets of your data, thus, make sure to either use the
792792
pandas access methods or explicitly handle the assignment creating a copy.
793793

794794
Fallback indexing
795795
~~~~~~~~~~~~~~~~~~~~
796796

797797
.. _indexing.fallback:
798798

799-
Float indexes should be used only with caution. If you have a float indexed
799+
Float indexes should be used only with caution. If you have a float indexed
800800
``DataFrame`` and try to select using an integer, the row that Pandas returns
801-
might not be what you expect. Pandas first attempts to use the *integer*
802-
as a *label* location, but fails to find a match (because the types
801+
might not be what you expect. Pandas first attempts to use the *integer*
802+
as a *label* location, but fails to find a match (because the types
803803
are not equal). Pandas then falls back to back to positional indexing.
804804

805805
.. ipython:: python
806806
807-
df = pd.DataFrame(np.random.randn(4,4),
807+
df = pd.DataFrame(np.random.randn(4,4),
808808
columns=list('ABCD'), index=[1.0, 2.0, 3.0, 4.0])
809809
df
810810
df.ix[1]
811811
812812
To select the row you do expect, instead use a float label or
813-
use ``iloc``.
813+
use ``iloc``.
814814

815815
.. ipython:: python
816816
817817
df.ix[1.0]
818818
df.iloc[0]
819-
819+
820820
Instead of using a float index, it is often better to
821821
convert to an integer index:
822822

@@ -1361,7 +1361,7 @@ incompatible the new object internals are with the ``Index`` functions):
13611361
- ``get_indexer``: Computes the indexing vector for reindexing / data
13621362
alignment purposes. See the source / docstrings for more on this
13631363
- ``get_indexer_non_unique``: Computes the indexing vector for reindexing / data
1364-
alignment purposes when the index is non-unique. See the source / docstrings
1364+
alignment purposes when the index is non-unique. See the source / docstrings
13651365
for more on this
13661366
- ``reindex``: Does any pre-conversion of the input index then calls
13671367
``get_indexer``

doc/source/io.rst

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -968,18 +968,24 @@ with optional parameters:
968968
- ``orient`` :
969969

970970
Series :
971-
default is 'index', allowed values are: {'split','records','index'}
971+
- default is ``index``
972+
- allowed values are {``split``, ``records``, ``index``}
972973

973-
DataFrame :
974-
default is 'columns', allowed values are: {'split','records','index','columns','values'}
974+
DataFrame
975+
- default is ``columns``
976+
- allowed values are {``split``, ``records``, ``index``, ``columns``, ``values``}
975977

976978
The format of the JSON string
977979

978-
* split : dict like {index -> [index], columns -> [columns], data -> [values]}
979-
* records : list like [{column -> value}, ... , {column -> value}]
980-
* index : dict like {index -> {column -> value}}
981-
* columns : dict like {column -> {index -> value}}
982-
* values : just the values array
980+
.. csv-table::
981+
:widths: 20, 150
982+
:delim: ;
983+
984+
``split``; dict like {index -> [index], columns -> [columns], data -> [values]}
985+
``records``; list like [{column -> value}, ... , {column -> value}]
986+
``index``; dict like {index -> {column -> value}}
987+
``columns``; dict like {column -> {index -> value}}
988+
``values``; just the values array
983989

984990
- ``date_format`` : type of date conversion (epoch = epoch milliseconds, iso = ISO8601), default is epoch
985991
- ``double_precision`` : The number of decimal places to use when encoding floating point values, default 10.
@@ -1029,18 +1035,24 @@ is ``None``. To explicity force ``Series`` parsing, pass ``typ=series``
10291035
- ``orient`` :
10301036

10311037
Series :
1032-
default is 'index', allowed values are: {'split','records','index'}
1038+
- default is ``index``
1039+
- allowed values are {``split``, ``records``, ``index``}
10331040

1034-
DataFrame :
1035-
default is 'columns', allowed values are: {'split','records','index','columns','values'}
1041+
DataFrame
1042+
- default is ``columns``
1043+
- allowed values are {``split``, ``records``, ``index``, ``columns``, ``values``}
10361044

10371045
The format of the JSON string
10381046

1039-
* split : dict like {index -> [index], columns -> [columns], data -> [values]}
1040-
* records : list like [{column -> value}, ... , {column -> value}]
1041-
* index : dict like {index -> {column -> value}}
1042-
* columns : dict like {column -> {index -> value}}
1043-
* values : just the values array
1047+
.. csv-table::
1048+
:widths: 20, 150
1049+
:delim: ;
1050+
1051+
``split``; dict like {index -> [index], columns -> [columns], data -> [values]}
1052+
``records``; list like [{column -> value}, ... , {column -> value}]
1053+
``index``; dict like {index -> {column -> value}}
1054+
``columns``; dict like {column -> {index -> value}}
1055+
``values``; just the values array
10441056

10451057
- ``dtype`` : if True, infer dtypes, if a dict of column to dtype, then use those, if False, then don't infer dtypes at all, default is True, apply only to the data
10461058
- ``convert_axes`` : boolean, try to convert the axes to the proper dtypes, default is True

0 commit comments

Comments
 (0)