You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/indexing.rst
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ attention in this area. Expect more work to be invested higher-dimensional data
32
32
structures (including Panel) in the future, especially in label-based advanced
33
33
indexing.
34
34
35
-
.. note::
35
+
.. note::
36
36
37
37
The Python and NumPy indexing operators ``[]`` and attribute operator ``.`` provide quick and easy access to pandas data structures
38
38
across a wide range of use cases. This makes interactive work intuitive, as
@@ -43,7 +43,7 @@ indexing.
43
43
that you take advantage of the optimized pandas data access methods exposed in this chapter.
44
44
45
45
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>`
47
47
48
48
See the :ref:`cookbook<cookbook.selection>` for some advanced strategies
49
49
@@ -69,7 +69,7 @@ three types of multi-axis indexing.
69
69
- A list or array of integers ``[4, 3, 0]``
70
70
- A slice object with ints ``1:7``
71
71
72
-
See more at :ref:`Selection by Position <indexing.integer>`
72
+
See more at :ref:`Selection by Position <indexing.integer>`
73
73
74
74
- ``.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
75
75
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:
449
449
# Multiple criteria
450
450
df2[criterion & (df2['b'] =='x')]
451
451
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>`,
453
453
and :ref:`Advanced Indexing <indexing.advanced>` you may select along more than one axis using boolean vectors combined with other indexing expressions.
454
454
455
455
.. ipython:: python
@@ -503,7 +503,7 @@ This can be done intuitively like so:
503
503
df2[df2 <0] =0
504
504
df2
505
505
506
-
Furthermore, ``where`` aligns the input boolean condition (ndarray or DataFrame),
506
+
Furthermore, ``where`` aligns the input boolean condition (ndarray or DataFrame),
507
507
such that partial selection with setting is possible. This is analagous to
508
508
partial setting via ``.ix`` (but on the contents rather than the axis labels)
509
509
@@ -513,7 +513,7 @@ partial setting via ``.ix`` (but on the contents rather than the axis labels)
513
513
df2[ df2[1:4] >0 ] =3
514
514
df2
515
515
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
517
517
optional parameter ``inplace`` so that the original data can be modified
518
518
without creating a copy:
519
519
@@ -788,35 +788,35 @@ In chained expressions, the order may determine whether a copy is returned or no
788
788
dfb[dfb.a.str.startswith('o')]['c'] =42# goes to copy (will be lost)
789
789
dfb['c'][dfb.a.str.startswith('o')] =42# passed via reference (will stay)
790
790
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
792
792
pandas access methods or explicitly handle the assignment creating a copy.
793
793
794
794
Fallback indexing
795
795
~~~~~~~~~~~~~~~~~~~~
796
796
797
797
.. _indexing.fallback:
798
798
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
800
800
``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
803
803
are not equal). Pandas then falls back to back to positional indexing.
804
804
805
805
.. ipython:: python
806
806
807
-
df = pd.DataFrame(np.random.randn(4,4),
807
+
df = pd.DataFrame(np.random.randn(4,4),
808
808
columns=list('ABCD'), index=[1.0, 2.0, 3.0, 4.0])
809
809
df
810
810
df.ix[1]
811
811
812
812
To select the row you do expect, instead use a float label or
813
-
use ``iloc``.
813
+
use ``iloc``.
814
814
815
815
.. ipython:: python
816
816
817
817
df.ix[1.0]
818
818
df.iloc[0]
819
-
819
+
820
820
Instead of using a float index, it is often better to
821
821
convert to an integer index:
822
822
@@ -1361,7 +1361,7 @@ incompatible the new object internals are with the ``Index`` functions):
1361
1361
- ``get_indexer``: Computes the indexing vector for reindexing / data
1362
1362
alignment purposes. See the source / docstrings for more on this
1363
1363
- ``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
1365
1365
for more on this
1366
1366
- ``reindex``: Does any pre-conversion of the input index then calls
Copy file name to clipboardExpand all lines: doc/source/io.rst
+28-16Lines changed: 28 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -968,18 +968,24 @@ with optional parameters:
968
968
- ``orient`` :
969
969
970
970
Series :
971
-
default is 'index', allowed values are: {'split','records','index'}
971
+
- default is ``index``
972
+
- allowed values are {``split``, ``records``, ``index``}
972
973
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``}
975
977
976
978
The format of the JSON string
977
979
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
983
989
984
990
- ``date_format`` : type of date conversion (epoch = epoch milliseconds, iso = ISO8601), default is epoch
985
991
- ``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``
1029
1035
- ``orient`` :
1030
1036
1031
1037
Series :
1032
-
default is 'index', allowed values are: {'split','records','index'}
1038
+
- default is ``index``
1039
+
- allowed values are {``split``, ``records``, ``index``}
1033
1040
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``}
1036
1044
1037
1045
The format of the JSON string
1038
1046
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
1044
1056
1045
1057
- ``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
1046
1058
- ``convert_axes`` : boolean, try to convert the axes to the proper dtypes, default is True
0 commit comments