Skip to content

Commit 9226749

Browse files
committed
all changes with black
1 parent 4aa267a commit 9226749

File tree

4 files changed

+11
-29
lines changed

4 files changed

+11
-29
lines changed

doc/source/getting_started/intro_tutorials/06_calculate_statistics.rst

+3-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ aggregating statistics for given columns can be defined using the
122122

123123
.. ipython:: python
124124
125-
titanic.agg({
126-
"Age": ["min", "max", "median", "skew"],
127-
"Fare": ["min", "max", "median", "mean"]
128-
})
125+
titanic.agg(
126+
{"Age": ["min", "max", "median", "skew"], "Fare": ["min", "max", "median", "mean"]}
127+
)
129128
130129
.. raw:: html
131130

doc/source/getting_started/intro_tutorials/07_reshape_table_layout.rst

+5-12
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ measurement.
102102
.. ipython:: python
103103
104104
air_quality = pd.read_csv(
105-
"data/air_quality_long.csv",
106-
index_col="date.utc",
107-
parse_dates=True
105+
"data/air_quality_long.csv", index_col="date.utc", parse_dates=True
108106
)
109107
air_quality.head()
110108
@@ -251,9 +249,8 @@ I want the mean concentrations for :math:`NO_2` and :math:`PM_{2.5}` in each of
251249
.. ipython:: python
252250
253251
air_quality.pivot_table(
254-
values="value", index="location",
255-
columns="parameter", aggfunc="mean"
256-
)
252+
values="value", index="location", columns="parameter", aggfunc="mean"
253+
)
257254
258255
In the case of :meth:`~DataFrame.pivot`, the data is only rearranged. When multiple
259256
values need to be aggregated (in this specific case, the values on
@@ -356,13 +353,9 @@ The :func:`pandas.melt` method can be defined in more detail:
356353
357354
no_2 = no2_pivoted.melt(
358355
id_vars="date.utc",
359-
value_vars=[
360-
"BETR801",
361-
"FR04014",
362-
"London Westminster"
363-
],
356+
value_vars=["BETR801", "FR04014", "London Westminster"],
364357
value_name="NO_2",
365-
var_name="id_location"
358+
var_name="id_location",
366359
)
367360
no_2.head()
368361

doc/source/getting_started/intro_tutorials/08_combine_dataframes.rst

+2-10
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ index. For example:
155155

156156
.. ipython:: python
157157
158-
air_quality_ = pd.concat([
159-
air_quality_pm25, air_quality_no2],
160-
keys=["PM25", "NO2"
161-
])
158+
air_quality_ = pd.concat([air_quality_pm25, air_quality_no2], keys=["PM25", "NO2"])
162159
163160
.. ipython:: python
164161
@@ -235,12 +232,7 @@ Add the station coordinates, provided by the stations metadata table, to the cor
235232
236233
.. ipython:: python
237234
238-
air_quality = pd.merge(
239-
air_quality,
240-
stations_coord,
241-
how='left',
242-
on='location'
243-
)
235+
air_quality = pd.merge(air_quality, stations_coord, how="left", on="location")
244236
air_quality.head()
245237
246238
Using the :meth:`~pandas.merge` function, for each of the rows in the

doc/source/getting_started/intro_tutorials/10_text_data.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ In the "Sex" column, replace values of "male" by "M" and values of "female" by "
224224

225225
.. ipython:: python
226226
227-
titanic["Sex_short"] = titanic["Sex"].replace({
228-
"male": "M", "female": "F"
229-
})
227+
titanic["Sex_short"] = titanic["Sex"].replace({"male": "M", "female": "F"})
230228
titanic["Sex_short"]
231229
232230
Whereas :meth:`~Series.replace` is not a string method, it provides a convenient way

0 commit comments

Comments
 (0)