Skip to content

Analyzing unicorn company data
Analyzing unicorn company data
In this workspace, we'll be exploring the relationship between total funding a company receives and its valuation.
DataFrameas
df
variable
select * from public.companies inner join ALTERDataFrameas
df1
variable
import pandas as pd
import requests
# Define the API endpoint and parameters
url = "https://api.worldbank.org/v2/en/indicator/EG.ELC.ACCS.ZS"
params = {"downloadformat": "csv", "source": "2"}
# Send a GET request to the API endpoint
response = requests.get(url, params=params)
# Load the response content into a pandas dataframe
df = pd.read_csv(response.content, skiprows=4)
# Filter the dataframe to only include European countries
european_countries = ["Albania", "Andorra", "Austria", "Belarus", "Belgium", "Bosnia and Herzegovina", "Bulgaria", "Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Iceland", "Ireland", "Italy", "Kosovo", "Latvia", "Liechtenstein", "Lithuania", "Luxembourg", "Malta", "Moldova", "Monaco", "Montenegro", "Netherlands", "North Macedonia", "Norway", "Poland", "Portugal", "Romania", "Russia", "San Marino", "Serbia", "Slovak Republic", "Slovenia", "Spain", "Sweden", "Switzerland", "Ukraine", "United Kingdom", "Vatican City"]
df = df[df["Country Name"].isin(european_countries)]
# Filter the dataframe to only include data from the last 10 years
df = df.iloc[:, :-2]
df = df.iloc[:, -10:]
# Transpose the dataframe so that the years are in the rows and the countries are in the columns
df = df.transpose()
# Rename the columns to be the country names
df.columns = df.iloc[0]
df = df.iloc[1:]
# Print the resulting dataframe
dfimport pandas as pd
import requests
from io import BytesIO
# Define the API endpoint and parameters
url = "https://api.worldbank.org/v2/en/indicator/NY.GDP.MKTP.CD"
params = {"downloadformat": "csv", "source": "2"}
# Send a GET request to the API endpoint
response = requests.get(url, params=params)
# Load the response content into a pandas dataframe
df = pd.read_csv(BytesIO(response.content), skiprows=4)
# Filter the dataframe to only include data from the last 5 years
df = df.iloc[:, :-62]
df = df.iloc[:, -5:]
# Transpose the dataframe so that the years are in the rows and the countries are in the columns
df = df.transpose()
# Rename the columns to be the country names
df.columns = df.iloc[0]
df = df.iloc[1:]
# Print the resulting dataframe
dfimport pandas as pd
import requests
from io import BytesIO