Skip to content

vanmeciv/Portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

M.Sc. Geospatial Technologies Projects

Example:

# Data Extraction
import requests, json, pandas as pd, numpy as np
from geopy import geocoders
from geopy.geocoders import Nominatim
# NHL API GET REQUEST
r = requests.get('https://statsapi.web.nhl.com/api/v1/game/##########/feed/live')
# See Repo link for redacted code
coordinates_df.to_csv('events.csv', header = True, mode = 'a')
# Data Compilation & Plot Events
import plotly.graph_objects as go, pandas as pd, plotly.express as px
mapbox_access_token = open("mapbox_token.txt").read() # Create a local file with mapbox token
# Read CSV F
df = pd.read_csv('events.csv')
# See Repo link for redacted code
fig.show()

Output:

Image Output Example

Example:

import requests, pandas as pd, numpy as np
# See Repo link for redacted code
# Creates datafrome of events with coordinates for georeferencing
df = pd.DataFrame(list
                  (zip(results_df['result.event'],
                       results_df['result.description'],
                       results_df['team.name'],
                       results_df['team.triCode'],
                       period_df['period'],
                       time_df['periodTime'],
                       time_df['dateTime'].str[:10],
                       lat,
                       lon,
                       results_df['result.strength.name'])), 
                  columns = ['Event',
                             'Description',
                             'Team',
                             'Tricode',
                             'Period',
                             'Time',
                             'Date',
                             'Lat',
                             'Lon',
                             'Strength'])
import plotly.graph_objects as go
fig1 = go.Figure()
# See Repo link for redacted code
# Allows user to filter Home Event Markers
fig1.add_trace(go.Scattermapbox(
        lat = home_lat,
        lon = home_lon,
        mode = 'markers',
        marker = go.scattermapbox.Marker(
            size = 20,
            color = '#0000ff',
            opacity = 0.25
        ),
        text = home_text,
        hoverinfo = 'text',
        name = "Home",
# https://plotly.com/python/hover-text-and-formatting/
        customdata = home,
        hovertemplate =
        '<b>Period</b>: %{customdata[4]}<br>'+
        '<b>Time</b>: %{customdata[5]}<br>'+
        '<b>Event</b>: %{customdata[0]}<br>'+
        '<b>Description</b>: %{customdata[1]}<br>'+
        '<b>Location</b>: %{customdata[10]}',
    ))
# Goal Scoring Sequence
fig2 = go.Figure(go.Scattermapbox(
    mode = "markers+lines",
    lon = a_seq['Lon'],
    lat = a_seq['Lat'],
    marker = {'size': 10},
    customdata=a_seq,
    name = "1st Goal (STL)",
    hovertemplate =
        '<b>Period</b>: %{customdata[4]}<br>'+
        '<b>Time</b>: %{customdata[5]}<br>'+
        '<b>Event</b>: %{customdata[0]}<br>'+
        '<b>Description</b>: %{customdata[1]}<br>'+
        '<b>Location</b>: %{customdata[10]}',
))

Output:

Image Output Example

M.Sc. Cybersecurity & Leadership Projects

Contact 💬


License