Skip to content

Commit e7d9057

Browse files
authored
DOC: Updating grammar for clarity, making punctuation consistent for examples (#43061)
1 parent 87ee512 commit e7d9057

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

doc/source/user_guide/10min.rst

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Customarily, we import as follows:
1919
Object creation
2020
---------------
2121

22-
See the :ref:`Data Structure Intro section <dsintro>`.
22+
See the :ref:`Intro to data structures section <dsintro>`.
2323

2424
Creating a :class:`Series` by passing a list of values, letting pandas create
2525
a default integer index:
@@ -39,7 +39,8 @@ and labeled columns:
3939
df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list("ABCD"))
4040
df
4141
42-
Creating a :class:`DataFrame` by passing a dict of objects that can be converted to series-like.
42+
Creating a :class:`DataFrame` by passing a dictionary of objects that can be
43+
converted into a series-like structure:
4344

4445
.. ipython:: python
4546
@@ -56,7 +57,7 @@ Creating a :class:`DataFrame` by passing a dict of objects that can be converted
5657
df2
5758
5859
The columns of the resulting :class:`DataFrame` have different
59-
:ref:`dtypes <basics.dtypes>`.
60+
:ref:`dtypes <basics.dtypes>`:
6061

6162
.. ipython:: python
6263
@@ -116,14 +117,14 @@ of the dtypes in the DataFrame. This may end up being ``object``, which requires
116117
casting every value to a Python object.
117118

118119
For ``df``, our :class:`DataFrame` of all floating-point values,
119-
:meth:`DataFrame.to_numpy` is fast and doesn't require copying data.
120+
:meth:`DataFrame.to_numpy` is fast and doesn't require copying data:
120121

121122
.. ipython:: python
122123
123124
df.to_numpy()
124125
125126
For ``df2``, the :class:`DataFrame` with multiple dtypes,
126-
:meth:`DataFrame.to_numpy` is relatively expensive.
127+
:meth:`DataFrame.to_numpy` is relatively expensive:
127128

128129
.. ipython:: python
129130
@@ -180,7 +181,7 @@ equivalent to ``df.A``:
180181
181182
df["A"]
182183
183-
Selecting via ``[]``, which slices the rows.
184+
Selecting via ``[]``, which slices the rows:
184185

185186
.. ipython:: python
186187
@@ -278,13 +279,13 @@ For getting fast access to a scalar (equivalent to the prior method):
278279
Boolean indexing
279280
~~~~~~~~~~~~~~~~
280281

281-
Using a single column's values to select data.
282+
Using a single column's values to select data:
282283

283284
.. ipython:: python
284285
285286
df[df["A"] > 0]
286287
287-
Selecting values from a DataFrame where a boolean condition is met.
288+
Selecting values from a DataFrame where a boolean condition is met:
288289

289290
.. ipython:: python
290291
@@ -303,7 +304,7 @@ Setting
303304
~~~~~~~
304305

305306
Setting a new column automatically aligns the data
306-
by the indexes.
307+
by the indexes:
307308

308309
.. ipython:: python
309310
@@ -329,13 +330,13 @@ Setting by assigning with a NumPy array:
329330
330331
df.loc[:, "D"] = np.array([5] * len(df))
331332
332-
The result of the prior setting operations.
333+
The result of the prior setting operations:
333334

334335
.. ipython:: python
335336
336337
df
337338
338-
A ``where`` operation with setting.
339+
A ``where`` operation with setting:
339340

340341
.. ipython:: python
341342
@@ -352,27 +353,27 @@ default not included in computations. See the :ref:`Missing Data section
352353
<missing_data>`.
353354

354355
Reindexing allows you to change/add/delete the index on a specified axis. This
355-
returns a copy of the data.
356+
returns a copy of the data:
356357

357358
.. ipython:: python
358359
359360
df1 = df.reindex(index=dates[0:4], columns=list(df.columns) + ["E"])
360361
df1.loc[dates[0] : dates[1], "E"] = 1
361362
df1
362363
363-
To drop any rows that have missing data.
364+
To drop any rows that have missing data:
364365

365366
.. ipython:: python
366367
367368
df1.dropna(how="any")
368369
369-
Filling missing data.
370+
Filling missing data:
370371

371372
.. ipython:: python
372373
373374
df1.fillna(value=5)
374375
375-
To get the boolean mask where values are ``nan``.
376+
To get the boolean mask where values are ``nan``:
376377

377378
.. ipython:: python
378379
@@ -402,7 +403,7 @@ Same operation on the other axis:
402403
df.mean(1)
403404
404405
Operating with objects that have different dimensionality and need alignment.
405-
In addition, pandas automatically broadcasts along the specified dimension.
406+
In addition, pandas automatically broadcasts along the specified dimension:
406407

407408
.. ipython:: python
408409
@@ -527,14 +528,14 @@ See the :ref:`Grouping section <groupby>`.
527528
df
528529
529530
Grouping and then applying the :meth:`~pandas.core.groupby.GroupBy.sum` function to the resulting
530-
groups.
531+
groups:
531532

532533
.. ipython:: python
533534
534535
df.groupby("A").sum()
535536
536537
Grouping by multiple columns forms a hierarchical index, and again we can
537-
apply the :meth:`~pandas.core.groupby.GroupBy.sum` function.
538+
apply the :meth:`~pandas.core.groupby.GroupBy.sum` function:
538539

539540
.. ipython:: python
540541
@@ -565,7 +566,7 @@ Stack
565566
df2
566567
567568
The :meth:`~DataFrame.stack` method "compresses" a level in the DataFrame's
568-
columns.
569+
columns:
569570

570571
.. ipython:: python
571572
@@ -673,21 +674,21 @@ pandas can include categorical data in a :class:`DataFrame`. For full docs, see
673674
674675
675676
676-
Convert the raw grades to a categorical data type.
677+
Converting the raw grades to a categorical data type:
677678

678679
.. ipython:: python
679680
680681
df["grade"] = df["raw_grade"].astype("category")
681682
df["grade"]
682683
683684
Rename the categories to more meaningful names (assigning to
684-
:meth:`Series.cat.categories` is in place!).
685+
:meth:`Series.cat.categories` is in place!):
685686

686687
.. ipython:: python
687688
688689
df["grade"].cat.categories = ["very good", "good", "very bad"]
689690
690-
Reorder the categories and simultaneously add the missing categories (methods under :meth:`Series.cat` return a new :class:`Series` by default).
691+
Reorder the categories and simultaneously add the missing categories (methods under :meth:`Series.cat` return a new :class:`Series` by default):
691692

692693
.. ipython:: python
693694
@@ -696,13 +697,13 @@ Reorder the categories and simultaneously add the missing categories (methods un
696697
)
697698
df["grade"]
698699
699-
Sorting is per order in the categories, not lexical order.
700+
Sorting is per order in the categories, not lexical order:
700701

701702
.. ipython:: python
702703
703704
df.sort_values(by="grade")
704705
705-
Grouping by a categorical column also shows empty categories.
706+
Grouping by a categorical column also shows empty categories:
706707

707708
.. ipython:: python
708709
@@ -722,7 +723,7 @@ We use the standard convention for referencing the matplotlib API:
722723
723724
plt.close("all")
724725
725-
The :meth:`~plt.close` method is used to `close <https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.close.html>`__ a figure window.
726+
The :meth:`~plt.close` method is used to `close <https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.close.html>`__ a figure window:
726727

727728
.. ipython:: python
728729
@@ -754,13 +755,13 @@ Getting data in/out
754755
CSV
755756
~~~
756757

757-
:ref:`Writing to a csv file. <io.store_in_csv>`
758+
:ref:`Writing to a csv file: <io.store_in_csv>`
758759

759760
.. ipython:: python
760761
761762
df.to_csv("foo.csv")
762763
763-
:ref:`Reading from a csv file. <io.read_csv_table>`
764+
:ref:`Reading from a csv file: <io.read_csv_table>`
764765

765766
.. ipython:: python
766767
@@ -778,13 +779,13 @@ HDF5
778779

779780
Reading and writing to :ref:`HDFStores <io.hdf5>`.
780781

781-
Writing to a HDF5 Store.
782+
Writing to a HDF5 Store:
782783

783784
.. ipython:: python
784785
785786
df.to_hdf("foo.h5", "df")
786787
787-
Reading from a HDF5 Store.
788+
Reading from a HDF5 Store:
788789

789790
.. ipython:: python
790791
@@ -800,13 +801,13 @@ Excel
800801

801802
Reading and writing to :ref:`MS Excel <io.excel>`.
802803

803-
Writing to an excel file.
804+
Writing to an excel file:
804805

805806
.. ipython:: python
806807
807808
df.to_excel("foo.xlsx", sheet_name="Sheet1")
808809
809-
Reading from an excel file.
810+
Reading from an excel file:
810811

811812
.. ipython:: python
812813

0 commit comments

Comments
 (0)