<jupyter_start><jupyter_text>Earthquakes Python Extract the earthquakes from Geo JSON url using pandas. Import relevant libraries<jupyter_code>import requests
import pandas as pd
import json
import numpy as np<jupyter_output><empty_output><jupyter_text>Specify URL<jupyter_code>json_url = 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson'<jupyter_output><empty_output><jupyter_text>Send a request to the URL to retrieve data<jupyter_code>def load_json_data(earthquakes_url):
    data = requests.get(earthquakes_url).json()
    return data<jupyter_output><empty_output><jupyter_text>Return list of places and magnitudes, where magnitude is greater than 1.0.We have to convert the magnitude from str to float type and a very easy way is using Numpy data type.<jupyter_code>def read_url(data):
    earthquakes_data = load_json_data(data)
    df = pd.read_json(json.dumps(earthquakes_data['features']), orient='columns')
    for f in df['properties']:
        magnitude = f['mag']
        place = f['place']
        if magnitude > 1.0:
            print(place, '|', magnitude)<jupyter_output><empty_output><jupyter_text>Call read_url()<jupyter_code>def main():
    read_url(json_url)
    
if __name__ == '__main__': 
    main()<jupyter_output>6km WNW of Cobb, CA | 1.11
6km WNW of Cobb, CA | 1.06
6km W of Cobb, CA | 1.19
7km NW of The Geysers, CA | 2.43
4km NNE of Cholame, CA | 1.58
7km NW of The Geysers, CA | 1.9500000000000002
1km NNW of The Geysers, CA | 3.49
7km WNW of Cobb, CA | 3.9
7km WNW of Cobb, CA | 1.13
7km W of Cobb, CA | 1.81
4km NW of Glen Avon, CA | 1.17
37km E of Yerington, Nevada | 1.1
32km NW of Fairview, Oklahoma | 1.53
86km E of `Ohonua, Tonga | 5
68km S of Deltana, Alaska | 1.2
4km NNW of Glen Avon, CA | 1.37
5km NNW of Glen Avon, CA | 1.02
114km NNW of Talkeetna, Alaska | 1.2
16km NE of Fairbanks, Alaska | 1.6
4km NW of Glen Avon, CA | 1.24
6km NNE of Woodcrest, CA | 1.45
49km E of Cape Yakataga, Alaska | 1.9
222km S of Kushiro, Japan | 3.9
16km SE of Volcano, Hawaii | 2.42
86km W of Healy, Alaska | 1.3
27km W of Nikiski, Alaska | 1.7000000000000002
5km NNE of Cabazon, CA | 1.07
23km E of Sutton-Alpine, Alaska | 1.3
62km ESE of Gabbs, Nevada | 2.5
112km N of College, Alaska | 1.1
109km W of Cantwell, Al[...]
{'fraction_non_alphanumeric': 0.09991197183098592, 'fraction_numerical': 0.07086267605633803, 'mean_word_length': 4.039911308203991, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '425604', 'license': 'MIT', 'n_tokens_mistral': 987, 'n_tokens_neox': 857, 'n_words': 289, 'path': 'notebooks/2_earthquakes_url_pandas_for_loop.ipynb', 'repo_name': 'arturosolutions/earthquakes_python', 'size': '2272'}