Skip to content

Commit c05caba

Browse files
committed
clean whitespace
1 parent 1cb0f3e commit c05caba

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

doc/source/cookbook.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,17 +1340,17 @@ Create two DataFrames with one column each from a subset of the unique values wi
13401340
13411341
.. ipython:: python
13421342
1343-
df1.A.dtype
1343+
df1.A.dtype
13441344
13451345
.. ipython:: python
13461346
1347-
df2.A.dtype
1347+
df2.A.dtype
13481348
13491349
.. ipython:: python
13501350
1351-
df3.A.dtype
1351+
df3.A.dtype
13521352
1353-
The data type of all the columns is Object. Using Categorical columns should improve memory usage.
1353+
The data type of all the columns is Object. Using Categorical columns should improve memory usage.
13541354

13551355
.. ipython:: python
13561356
@@ -1367,17 +1367,17 @@ The data type of all the columns is Object. Using Categorical columns should imp
13671367
.. ipython:: python
13681368
13691369
dfc3 = dfc1.append(dfc2)
1370-
dfc3.memory_usage()
1370+
dfc3.memory_usage()
13711371
13721372
.. ipython:: python
13731373
13741374
df3.A.dtype
13751375
1376-
The first two Dataframes used a lot less memory because their columns are Categorical, but the column in the third Dataframe has a data type of Object and is using the same amount of memory as before. The appended category columns were converted into an object column because the columns' categories are incompatible:
1376+
The first two Dataframes used a lot less memory because their columns are Categorical, but the column in the third Dataframe has a data type of Object and is using the same amount of memory as before. The appended category columns were converted into an object column because the columns' categories are incompatible:
13771377

13781378
.. ipython:: python
13791379
1380-
dfc1.A.cat.categories
1380+
dfc1.A.cat.categories
13811381
13821382
.. ipython:: python
13831383
@@ -1404,12 +1404,10 @@ This time the same categories are specified for both of the starting columns.
14041404
dfc3 = dfc1.append(dfc2)
14051405
dfc3.memory_usage()
14061406
1407-
The resulting DataFrame's memory usage is far smaller now that the data type of the final column is Category. It worked as expected this time because the code --> category mapping was the same for both of the original columns, which carried over to the final column:
1407+
The resulting DataFrame's memory usage is far smaller now that the data type of the final column is Category. It worked as expected this time because the code --> category mapping was the same for both of the original columns, which carried over to the final column:
14081408

14091409
.. ipython:: python
14101410
14111411
[(code, cat) for code, cat in enumerate(dfc3.A.cat.categories)]
14121412
14131413
`More information about categorical data <http://pandas.pydata.org/pandas-docs/stable/categorical.html>`__
1414-
1415-

0 commit comments

Comments
 (0)