Skip to content

Commit def814f

Browse files
committed
Fix
1 parent 90126cc commit def814f

File tree

8 files changed

+57
-18
lines changed

8 files changed

+57
-18
lines changed

doc/source/user_guide/advanced.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ whereas a tuple of lists refer to several values within a level:
304304
.. ipython:: python
305305
306306
s = pd.Series(
307-
[1, 2, 3, 4, 5, 6], index=pd.MultiIndex.from_product([["A", "B"], ["c", "d", "e"]])
307+
[1, 2, 3, 4, 5, 6],
308+
index=pd.MultiIndex.from_product([["A", "B"], ["c", "d", "e"]]),
308309
)
309310
s.loc[[("A", "c"), ("B", "d")]] # list of tuples
310311
s.loc[(["A", "B"], ["c", "d"])] # tuple of lists
@@ -819,7 +820,9 @@ values **not** in the categories, similarly to how you can reindex **any** panda
819820

820821
.. ipython:: python
821822
822-
df3 = pd.DataFrame({"A": np.arange(3), "B": pd.Series(list("abc")).astype("category")})
823+
df3 = pd.DataFrame(
824+
{"A": np.arange(3), "B": pd.Series(list("abc")).astype("category")}
825+
)
823826
df3 = df3.set_index("B")
824827
df3
825828
@@ -934,7 +937,9 @@ example, be millisecond offsets.
934937
np.random.randn(5, 2), index=np.arange(5) * 250.0, columns=list("AB")
935938
),
936939
pd.DataFrame(
937-
np.random.randn(6, 2), index=np.arange(4, 10) * 250.1, columns=list("AB")
940+
np.random.randn(6, 2),
941+
index=np.arange(4, 10) * 250.1,
942+
columns=list("AB"),
938943
),
939944
]
940945
)

doc/source/user_guide/basics.rst

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ which we illustrate:
464464
{"A": [1.0, np.nan, 3.0, 5.0, np.nan], "B": [np.nan, 2.0, 3.0, np.nan, 6.0]}
465465
)
466466
df2 = pd.DataFrame(
467-
{"A": [5.0, 2.0, 4.0, np.nan, 3.0, 7.0], "B": [np.nan, np.nan, 3.0, 4.0, 6.0, 8.0]}
467+
{
468+
"A": [5.0, 2.0, 4.0, np.nan, 3.0, 7.0],
469+
"B": [np.nan, np.nan, 3.0, 4.0, 6.0, 8.0],
470+
}
468471
)
469472
df1
470473
df2
@@ -712,7 +715,10 @@ Similarly, you can get the most frequently occurring value(s), i.e. the mode, of
712715
s5 = pd.Series([1, 1, 3, 3, 3, 5, 5, 7, 7, 7])
713716
s5.mode()
714717
df5 = pd.DataFrame(
715-
{"A": np.random.randint(0, 7, size=50), "B": np.random.randint(-10, 15, size=50)}
718+
{
719+
"A": np.random.randint(0, 7, size=50),
720+
"B": np.random.randint(-10, 15, size=50),
721+
}
716722
)
717723
df5.mode()
718724
@@ -1192,7 +1198,9 @@ to :ref:`merging/joining functionality <merging>`:
11921198

11931199
.. ipython:: python
11941200
1195-
s = pd.Series(["six", "seven", "six", "seven", "six"], index=["a", "b", "c", "d", "e"])
1201+
s = pd.Series(
1202+
["six", "seven", "six", "seven", "six"], index=["a", "b", "c", "d", "e"]
1203+
)
11961204
t = pd.Series({"six": 6.0, "seven": 7.0})
11971205
s
11981206
s.map(t)
@@ -1494,7 +1502,9 @@ labels).
14941502
14951503
df = pd.DataFrame(
14961504
{"x": [1, 2, 3, 4, 5, 6], "y": [10, 20, 30, 40, 50, 60]},
1497-
index=pd.MultiIndex.from_product([["a", "b", "c"], [1, 2]], names=["let", "num"]),
1505+
index=pd.MultiIndex.from_product(
1506+
[["a", "b", "c"], [1, 2]], names=["let", "num"]
1507+
),
14981508
)
14991509
df
15001510
df.rename_axis(index={"let": "abc"})
@@ -1803,7 +1813,9 @@ used to sort a pandas object by its index levels.
18031813
}
18041814
)
18051815
1806-
unsorted_df = df.reindex(index=["a", "d", "c", "b"], columns=["three", "two", "one"])
1816+
unsorted_df = df.reindex(
1817+
index=["a", "d", "c", "b"], columns=["three", "two", "one"]
1818+
)
18071819
unsorted_df
18081820
18091821
# DataFrame
@@ -1849,7 +1861,9 @@ to use to determine the sorted order.
18491861

18501862
.. ipython:: python
18511863
1852-
df1 = pd.DataFrame({"one": [2, 1, 1, 1], "two": [1, 3, 2, 4], "three": [5, 4, 3, 2]})
1864+
df1 = pd.DataFrame(
1865+
{"one": [2, 1, 1, 1], "two": [1, 3, 2, 4], "three": [5, 4, 3, 2]}
1866+
)
18531867
df1.sort_values(by="two")
18541868
18551869
The ``by`` parameter can take a list of column names, e.g.:
@@ -1994,7 +2008,9 @@ all levels to ``by``.
19942008

19952009
.. ipython:: python
19962010
1997-
df1.columns = pd.MultiIndex.from_tuples([("a", "one"), ("a", "two"), ("b", "three")])
2011+
df1.columns = pd.MultiIndex.from_tuples(
2012+
[("a", "one"), ("a", "two"), ("b", "three")]
2013+
)
19982014
df1.sort_values(by=("a", "two"))
19992015
20002016
@@ -2245,7 +2261,11 @@ to the correct type.
22452261
import datetime
22462262
22472263
df = pd.DataFrame(
2248-
[[1, 2], ["a", "b"], [datetime.datetime(2016, 3, 2), datetime.datetime(2016, 3, 2)]]
2264+
[
2265+
[1, 2],
2266+
["a", "b"],
2267+
[datetime.datetime(2016, 3, 2), datetime.datetime(2016, 3, 2)],
2268+
]
22492269
)
22502270
df = df.T
22512271
df

doc/source/whatsnew/v0.10.1.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ combined result, by using ``where`` on a selector table.
180180
store.select("df2_mt")
181181
182182
# as a multiple
183-
store.select_as_multiple(["df1_mt", "df2_mt"], where=["A>0", "B>0"], selector="df1_mt")
183+
store.select_as_multiple(
184+
["df1_mt", "df2_mt"], where=["A>0", "B>0"], selector="df1_mt"
185+
)
184186
185187
.. ipython:: python
186188
:suppress:

doc/source/whatsnew/v0.13.1.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ Output formatting enhancements
101101

102102
.. ipython:: python
103103
104-
df = pd.DataFrame([pd.Timestamp("20010101"), pd.Timestamp("20040601")], columns=["age"])
104+
df = pd.DataFrame(
105+
[pd.Timestamp("20010101"), pd.Timestamp("20040601")], columns=["age"]
106+
)
105107
df["today"] = pd.Timestamp("20130419")
106108
df["diff"] = df["today"] - df["age"]
107109
df
@@ -206,7 +208,9 @@ Enhancements
206208
.. code-block:: python
207209
208210
# Try to infer the format for the index column
209-
df = pd.read_csv("foo.csv", index_col=0, parse_dates=True, infer_datetime_format=True)
211+
df = pd.read_csv(
212+
"foo.csv", index_col=0, parse_dates=True, infer_datetime_format=True
213+
)
210214
211215
- ``date_format`` and ``datetime_format`` keywords can now be specified when writing to ``excel``
212216
files (:issue:`4133`)

doc/source/whatsnew/v0.14.1.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ Enhancements
124124

125125
.. ipython:: python
126126
127-
rng = pd.date_range("3/6/2012 00:00", periods=10, freq="D", tz="dateutil/Europe/London")
127+
rng = pd.date_range(
128+
"3/6/2012 00:00", periods=10, freq="D", tz="dateutil/Europe/London"
129+
)
128130
rng.tz
129131
130132
See :ref:`the docs <timeseries.timezone>`.

doc/source/whatsnew/v0.17.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,9 @@ Previous behavior:
786786

787787
.. ipython:: python
788788
789-
df_with_missing = pd.DataFrame({"col1": [0, np.nan, 2], "col2": [1, np.nan, np.nan]})
789+
df_with_missing = pd.DataFrame(
790+
{"col1": [0, np.nan, 2], "col2": [1, np.nan, np.nan]}
791+
)
790792
791793
df_with_missing
792794

doc/source/whatsnew/v0.19.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,9 @@ Previously, most ``Index`` classes returned ``np.ndarray``, and ``DatetimeIndex`
10911091
.. ipython:: python
10921092
10931093
pd.Index([1, 2, 3]).unique()
1094-
pd.DatetimeIndex(["2011-01-01", "2011-01-02", "2011-01-03"], tz="Asia/Tokyo").unique()
1094+
pd.DatetimeIndex(
1095+
["2011-01-01", "2011-01-02", "2011-01-03"], tz="Asia/Tokyo"
1096+
).unique()
10951097
10961098
.. _whatsnew_0190.api.multiindex:
10971099

doc/source/whatsnew/v0.8.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ types. For example, ``'kde'`` is a new option:
178178

179179
.. ipython:: python
180180
181-
s = pd.Series(np.concatenate((np.random.randn(1000), np.random.randn(1000) * 0.5 + 3)))
181+
s = pd.Series(
182+
np.concatenate((np.random.randn(1000), np.random.randn(1000) * 0.5 + 3))
183+
)
182184
plt.figure()
183185
s.hist(density=True, alpha=0.2)
184186
s.plot(kind="kde")

0 commit comments

Comments
 (0)