satellite.py

In this script we will plot the position of ISS. In order to do this we will use this API.

Import the required modules pandas and plotly

import pandas as pd
import plotly.express as px

We will use the API found here.

url = ‘http://api.open-notify.org/iss-now.json'

Next we need to read our data which are in a json format (some kind of file)

dataFrame = pd.read_json(url)

Print the dataFrame and see our results

print(dataFrame)

Let’s shape a little bit our data the way we want them to be.

dataFrame[‘latitude’] = dataFrame.loc[‘latitude’,’iss_position’]
dataFrame[‘longitude’] = dataFrame.loc[‘longitude’, ‘iss_position’]
dataFrame.reset_index(inplace=True)

print the data again…do you see the diferrence?

Now let’s get rid of some data and fine tune them

dataFrame = dataFrame.drop([‘index’, ‘message’], axis=1)

Let’s plot out data

figure = px.scatter_geo(dataFrame, lat=”latitude”, lon=”longitude”)
figure.show()

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Infant Mortality Rate: Past and Future Global Comparisons

Descriptive Statistics — Measures of Shape

Lets model COVID (no Tyra)

Zs Associates Case Study Interview Template

The Power of Data: My Journey Into the Field

When to Pull the Goalie: Running the Numbers on NHL Goalie Pulls

Data Governance & Performance Management in Lincoln, Nebraska

COVID-19 in Namibia: What the Data Says

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marinoskouvaras

Marinoskouvaras

More from Medium

Flatten a nested list using recursion

CaDS— Code and Data Society

Python — Advent of Code: Day 1

Understanding Iterators in Python