<jupyter_start><jupyter_text>Digital Tools and Big Data  This is an example of how to improve readability of coding components. Here we replicate or very first script Add more text  Library import<jupyter_code>!pip install ipyleaflet
!pip install geopandas<jupyter_output>Collecting ipyleaflet
  Downloading ipyleaflet-0.16.0-py2.py3-none-any.whl (3.3 MB)
[K     |████████████████████████████████| 3.3 MB 5.0 MB/s 
[?25hCollecting xyzservices>=2021.8.1
  Downloading xyzservices-2022.4.0-py3-none-any.whl (36 kB)
Requirement already satisfied: ipywidgets<8,>=7.6.0 in /usr/local/lib/python3.7/dist-packages (from ipyleaflet) (7.7.0)
Collecting traittypes<3,>=0.2.1
  Downloading traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)
Requirement already satisfied: ipython>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets<8,>=7.6.0->ipyleaflet) (5.5.0)
Requirement already satisfied: ipykernel>=4.5.1 in /usr/local/lib/python3.7/dist-packages (from ipywidgets<8,>=7.6.0->ipyleaflet) (4.10.1)
Requirement already satisfied: widgetsnbextension~=3.6.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets<8,>=7.6.0->ipyleaflet) (3.6.0)
Requirement already satisfied: traitlets>=4.3.1 in /usr/local/lib/python3.7/dist-packages (from ipywidgets<8,>=7.6.0->ipyl[...]<jupyter_text>This section shows how to import all the libraries needed to plot a geospatial data set using python<jupyter_code>import pandas as pd
import geopandas
import matplotlib.pyplot as plt
from shapely.geometry import Point<jupyter_output><empty_output><jupyter_text>Reading Data This section shows how to read a dataset using a URL. In this case we get data from [open data barcelona](https://opendata-ajuntament.barcelona.cat/data/dataset/82dc847a-661d-4701-a582-b0c1aba89b2a/resource/feafec8a-b389-42b5-a85d-cf16f3976440)<jupyter_code>url = 'https://opendata-ajuntament.barcelona.cat/data/dataset/82dc847a-661d-4701-a582-b0c1aba89b2a/resource/feafec8a-b389-42b5-a85d-cf16f3976440/download'
bcn_stations = pd.read_csv(url)<jupyter_output><empty_output><jupyter_text>Setting up geospatial features This section shows how to prepare the geospatial data set using geopandas<jupyter_code>crs = {'init': 'epsg:4326'}
geometry = [Point(xy) for xy in zip(bcn_stations["LONGITUD"], bcn_stations["LATITUD"])]
bcn_stations_geo = geopandas.GeoDataFrame(bcn_stations, crs=crs, geometry=geometry)<jupyter_output>/usr/local/lib/python3.7/dist-packages/pyproj/crs/crs.py:131: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  in_crs_string = _prepare_from_proj_string(in_crs_string)<jupyter_text>Plotting geospatial data This section shows how we can plot geospatial data using geopandas<jupyter_code>f, ax = plt.subplots()
bcn_stations_geo.plot(ax=ax, marker='o', color='green', markersize=20)
plt.show()<jupyter_output><empty_output><jupyter_text>Bonus: Additional features There are additional features that emerge from using a web environment. An example is the web mapping integration summarised in this [blog post](https://carpentries-incubator.github.io/jupyter_maps/aio.html)<jupyter_code>from ipyleaflet import Map
Map()<jupyter_output><empty_output><jupyter_text>There are additional configuration alternatives to work with the web mapping tools. We should be aware of the need for extra tools like extensions (in this case JupiterLab)<jupyter_code>from ipyleaflet import Map, basemaps

# Map centred on (60 degrees latitude et -2.2 degrees longitude)
# Latitude, longitude
Map(center = (60, -2.2), zoom = 2, min_zoom = 1, max_zoom = 20, 
    basemap=basemaps.Stamen.Terrain)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12355415352260778, 'fraction_numerical': 0.05152471083070452, 'mean_word_length': 6.152255639097745, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 45, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '558777', 'license': 'Apache-2.0', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1389, 'n_words': 309, 'path': 'session_1/b_local_notebook.ipynb', 'repo_name': 'JiyunLee2021/Programming_with_python_2122', 'size': '3804'}