Skip to content

Commit 8c0b883

Browse files
Apply suggestions from code review
Co-authored-by: Simon Hawkins <[email protected]>
1 parent db42937 commit 8c0b883

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

doc/source/user_guide/migration-3-strings.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ enable it with:
1818
1919
pd.options.future.infer_string = True
2020
21-
This allows to test your code before the final 3.0 release.
21+
This allows you to test your code before the final 3.0 release.
2222

2323
Background
2424
----------
2525

2626
Historically, pandas has always used the NumPy ``object`` dtype as the default
2727
to store text data. This has two primary drawbacks. First, ``object`` dtype is
28-
not specific to strings: any Python object can be stored in an ``object```-dtype
28+
not specific to strings: any Python object can be stored in an ``object``-dtype
2929
array, not just strings, and seeing ``object`` as the dtype for a column with
3030
strings is confusing for users. Second, this is not always very efficient (both
31-
performance wise as for memory usage).
31+
performance wise and for memory usage).
3232

3333
Since pandas 1.0, an opt-in string data type has been available, but this has
3434
not yet been made the default, and uses the ``pd.NA`` scalar to represent
@@ -57,7 +57,7 @@ for more background and details.
5757
.. - None gets coerced to NaN
5858
.. - setitem raises an error for non-string data
5959
60-
Brief intro to the new default string dtype
60+
Brief introduction to the new default string dtype
6161
-------------------------------------------
6262

6363
By default, pandas will infer this new string dtype instead of object dtype for
@@ -86,14 +86,14 @@ It can also be specified explicitly using the ``"str"`` alias:
8686
2 NaN
8787
dtype: str
8888
89-
In contrast the the current object dtype, the new string dtype will only store
89+
In contrast to the current object dtype, the new string dtype will only store
9090
strings. This also means that it will raise an error if you try to store a
9191
non-string value in it (see below for more details).
9292

9393
Missing values with the new string dtype are always represented as ``NaN``, and
94-
the missing value behaviour is similar as for other default dtypes.
94+
the missing value behaviour is similar to other default dtypes.
9595

96-
For the rest, this new string dtype should work the same as how you have been
96+
This new string dtype should work the same as how you have been
9797
using pandas with string data today. For example, all string-specific methods
9898
through the ``str`` accessor will work the same:
9999

@@ -143,7 +143,7 @@ To check for columns with string data, you should instead use:
143143
144144
>>> ser.dtype == "str"
145145
146-
**How to write compatible code?**
146+
**How to write compatible code**
147147

148148
For code that should work on both pandas 2.x and 3.x, you can use the
149149
:func:`pandas.api.types.is_string_dtype` function:
@@ -153,7 +153,7 @@ For code that should work on both pandas 2.x and 3.x, you can use the
153153
>>> pd.api.types.is_string_dtype(ser.dtype)
154154
True
155155
156-
This will return ``True`` for both the object dtype as for the string dtypes.
156+
This will return ``True`` for both the object dtype and the string dtypes.
157157

158158
Hardcoded use of object dtype
159159
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -253,7 +253,7 @@ impacted by this change.
253253
**How to write compatible code?**
254254
255255
You can update your code to ensure you only set string values in such columns,
256-
or otherwise you have explicitly ensure the column has object dtype first. This
256+
or otherwise you can explicitly ensure the column has object dtype first. This
257257
can be done by specifying the dtype explicitly in the constructor, or by using
258258
the :meth:`~pandas.Series.astype` method:
259259

@@ -264,7 +264,7 @@ the :meth:`~pandas.Series.astype` method:
264264
>>> ser[1] = 2.5
265265
266266
This ``astype("object")`` call will be redundant when using pandas 2.x, but
267-
this way such code can work for all versions.
267+
this code will work for all versions.
268268

269269
For existing users of the nullable ``StringDtype``
270270
--------------------------------------------------

0 commit comments

Comments
 (0)