Skip to content

Commit 40a330d

Browse files
Combine setting up dictionary and converting to dataframe
Co-authored-by: Dongdong Tian <[email protected]>
1 parent abb7ae7 commit 40a330d

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

examples/tutorials/advanced/focal_mechanisms.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -286,26 +286,26 @@
286286
# Data of four earthquakes taken from USGS.
287287
# Provide lists.
288288

289-
# Set up a dictionary
290-
aki_dict_multiple = {
291-
"strike": [255, 173, 295, 318],
292-
"dip": [70, 68, 79, 89],
293-
"rake": [20, 83, -177, -179],
294-
"magnitude": [7.0, 5.8, 6.0, 7.8],
295-
"longitude": [-72.53, -79.61, 69.46, 37.01],
296-
"latitude": [18.44, 0.90, 33.02, 37.23],
297-
"depth": [13, 19, 4, 10],
298-
"plot_longitude": [-70, -110, 100, 0],
299-
"plot_latitude": [40, 10, 50, 55],
300-
"event_name": [
301-
"Haiti - 2010/01/12",
302-
"Esmeraldas - 2022/03/27",
303-
"Afghanistan - 2022/06/21",
304-
"Syria/Turkey - 2023/02/06",
305-
],
306-
}
307-
# Convert to a pandas.DataFrame
308-
aki_df_multiple = pd.DataFrame(aki_dict_multiple)
289+
# Set up a pandas.DataFrame with multiple focal mechanism parameters.
290+
aki_df_multiple = pd.DataFrame(
291+
{
292+
"strike": [255, 173, 295, 318],
293+
"dip": [70, 68, 79, 89],
294+
"rake": [20, 83, -177, -179],
295+
"magnitude": [7.0, 5.8, 6.0, 7.8],
296+
"longitude": [-72.53, -79.61, 69.46, 37.01],
297+
"latitude": [18.44, 0.90, 33.02, 37.23],
298+
"depth": [13, 19, 4, 10],
299+
"plot_longitude": [-70, -110, 100, 0],
300+
"plot_latitude": [40, 10, 50, 55],
301+
"event_name": [
302+
"Haiti - 2010/01/12",
303+
"Esmeraldas - 2022/03/27",
304+
"Afghanistan - 2022/06/21",
305+
"Syria/Turkey - 2023/02/06",
306+
],
307+
}
308+
)
309309

310310

311311
# %%

0 commit comments

Comments
 (0)