Skip to content

Commit 3875acc

Browse files
author
y-p
committed
DOC: update options section, not new anymore
1 parent 258c7e3 commit 3875acc

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

doc/source/basics.rst

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Accelerated operations
9292
----------------------
9393

9494
Pandas has support for accelerating certain types of binary numerical and boolean operations using
95-
the ``numexpr`` library (starting in 0.11.0) and the ``bottleneck`` libraries.
95+
the ``numexpr`` library (starting in 0.11.0) and the ``bottleneck`` libraries.
9696

9797
These libraries are especially useful when dealing with large data sets, and provide large
9898
speedups. ``numexpr`` uses smart chunking, caching, and multiple cores. ``bottleneck`` is
@@ -110,7 +110,7 @@ Here is a sample (using 100 column x 100,000 row ``DataFrames``):
110110
``df1 * df2``; 21.71; 36.63; 0.5928
111111
``df1 + df2``; 22.04; 36.50; 0.6039
112112

113-
You are highly encouraged to install both libraries. See the section
113+
You are highly encouraged to install both libraries. See the section
114114
:ref:`Recommended Dependencies <install.recommended_dependencies>` for more installation info.
115115

116116
.. _basics.binop:
@@ -1011,16 +1011,16 @@ dtypes
10111011
------
10121012

10131013
The main types stored in pandas objects are ``float``, ``int``, ``bool``, ``datetime64[ns]``, ``timedelta[ns]``,
1014-
and ``object``. In addition these dtypes have item sizes, e.g. ``int64`` and ``int32``. A convenient ``dtypes``
1014+
and ``object``. In addition these dtypes have item sizes, e.g. ``int64`` and ``int32``. A convenient ``dtypes``
10151015
attribute for DataFrames returns a Series with the data type of each column.
10161016

10171017
.. ipython:: python
10181018
1019-
dft = DataFrame(dict( A = np.random.rand(3),
1020-
B = 1,
1021-
C = 'foo',
1022-
D = Timestamp('20010102'),
1023-
E = Series([1.0]*3).astype('float32'),
1019+
dft = DataFrame(dict( A = np.random.rand(3),
1020+
B = 1,
1021+
C = 'foo',
1022+
D = Timestamp('20010102'),
1023+
E = Series([1.0]*3).astype('float32'),
10241024
F = False,
10251025
G = Series([1]*3,dtype='int8')))
10261026
dft
@@ -1032,7 +1032,7 @@ On a ``Series`` use the ``dtype`` method.
10321032
10331033
dft['A'].dtype
10341034
1035-
If a pandas object contains data multiple dtypes *IN A SINGLE COLUMN*, the dtype of the
1035+
If a pandas object contains data multiple dtypes *IN A SINGLE COLUMN*, the dtype of the
10361036
column will be chosen to accommodate all of the data types (``object`` is the most
10371037
general).
10381038

@@ -1051,26 +1051,26 @@ each type in a ``DataFrame``:
10511051
10521052
dft.get_dtype_counts()
10531053
1054-
Numeric dtypes will propagate and can coexist in DataFrames (starting in v0.11.0).
1055-
If a dtype is passed (either directly via the ``dtype`` keyword, a passed ``ndarray``,
1056-
or a passed ``Series``, then it will be preserved in DataFrame operations. Furthermore,
1054+
Numeric dtypes will propagate and can coexist in DataFrames (starting in v0.11.0).
1055+
If a dtype is passed (either directly via the ``dtype`` keyword, a passed ``ndarray``,
1056+
or a passed ``Series``, then it will be preserved in DataFrame operations. Furthermore,
10571057
different numeric dtypes will **NOT** be combined. The following example will give you a taste.
10581058

10591059
.. ipython:: python
10601060
10611061
df1 = DataFrame(randn(8, 1), columns = ['A'], dtype = 'float32')
10621062
df1
10631063
df1.dtypes
1064-
df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'),
1065-
B = Series(randn(8)),
1064+
df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'),
1065+
B = Series(randn(8)),
10661066
C = Series(np.array(randn(8),dtype='uint8')) ))
10671067
df2
10681068
df2.dtypes
10691069
10701070
defaults
10711071
~~~~~~~~
10721072

1073-
By default integer types are ``int64`` and float types are ``float64``,
1073+
By default integer types are ``int64`` and float types are ``float64``,
10741074
*REGARDLESS* of platform (32-bit or 64-bit). The following will all result in ``int64`` dtypes.
10751075

10761076
.. ipython:: python
@@ -1090,7 +1090,7 @@ The following **WILL** result in ``int32`` on 32-bit platform.
10901090
upcasting
10911091
~~~~~~~~~
10921092

1093-
Types can potentially be *upcasted* when combined with other types, meaning they are promoted
1093+
Types can potentially be *upcasted* when combined with other types, meaning they are promoted
10941094
from the current type (say ``int`` to ``float``)
10951095

10961096
.. ipython:: python
@@ -1099,8 +1099,8 @@ from the current type (say ``int`` to ``float``)
10991099
df3
11001100
df3.dtypes
11011101
1102-
The ``values`` attribute on a DataFrame return the *lower-common-denominator* of the dtypes, meaning
1103-
the dtype that can accomodate **ALL** of the types in the resulting homogenous dtyped numpy array. This can
1102+
The ``values`` attribute on a DataFrame return the *lower-common-denominator* of the dtypes, meaning
1103+
the dtype that can accomodate **ALL** of the types in the resulting homogenous dtyped numpy array. This can
11041104
force some *upcasting*.
11051105

11061106
.. ipython:: python
@@ -1116,7 +1116,7 @@ You can use the ``astype`` method to explicity convert dtypes from one to anothe
11161116
even if the dtype was unchanged (pass ``copy=False`` to change this behavior). In addition, they will raise an
11171117
exception if the astype operation is invalid.
11181118

1119-
Upcasting is always according to the **numpy** rules. If two different dtypes are involved in an operation,
1119+
Upcasting is always according to the **numpy** rules. If two different dtypes are involved in an operation,
11201120
then the more *general* one will be used as the result of the operation.
11211121

11221122
.. ipython:: python
@@ -1132,7 +1132,7 @@ object conversion
11321132

11331133
``convert_objects`` is a method to try to force conversion of types from the ``object`` dtype to other types.
11341134
To force conversion of specific types that are *number like*, e.g. could be a string that represents a number,
1135-
pass ``convert_numeric=True``. This will force strings and numbers alike to be numbers if possible, otherwise
1135+
pass ``convert_numeric=True``. This will force strings and numbers alike to be numbers if possible, otherwise
11361136
they will be set to ``np.nan``.
11371137

11381138
.. ipython:: python
@@ -1146,20 +1146,20 @@ they will be set to ``np.nan``.
11461146
df3['E'] = df3['E'].astype('int32')
11471147
df3.dtypes
11481148
1149-
To force conversion to ``datetime64[ns]``, pass ``convert_dates='coerce'``.
1149+
To force conversion to ``datetime64[ns]``, pass ``convert_dates='coerce'``.
11501150
This will convert any datetimelike object to dates, forcing other values to ``NaT``.
11511151
This might be useful if you are reading in data which is mostly dates,
11521152
but occasionally has non-dates intermixed and you want to represent as missing.
11531153

11541154
.. ipython:: python
11551155
1156-
s = Series([datetime(2001,1,1,0,0),
1157-
'foo', 1.0, 1, Timestamp('20010104'),
1156+
s = Series([datetime(2001,1,1,0,0),
1157+
'foo', 1.0, 1, Timestamp('20010104'),
11581158
'20010105'],dtype='O')
11591159
s
11601160
s.convert_objects(convert_dates='coerce')
11611161
1162-
In addition, ``convert_objects`` will attempt the *soft* conversion of any *object* dtypes, meaning that if all
1162+
In addition, ``convert_objects`` will attempt the *soft* conversion of any *object* dtypes, meaning that if all
11631163
the objects in a Series are of the same type, the Series will have that dtype.
11641164

11651165
gotchas
@@ -1230,10 +1230,12 @@ Working with package options
12301230
----------------------------
12311231

12321232
.. _basics.working_with_options:
1233+
.. versionadded:: 0.10.1
12331234

1234-
Introduced in 0.10.0, pandas supports a new system for working with options.
1235-
Options have a full "dotted-style", case-insensitive name (e.g. ``display.max_rows``),
1235+
Pandas has an options system that let's you customize some aspects of it's behaviour,
1236+
display-related options being those the user is must likely to adjust.
12361237

1238+
Options have a full "dotted-style", case-insensitive name (e.g. ``display.max_rows``),
12371239
You can get/set options directly as attributes of the top-level ``options`` attribute:
12381240

12391241
.. ipython:: python

0 commit comments

Comments
 (0)