Skip to content

Analyzing unicorn company data

In this workspace, we'll be exploring the relationship between total funding a company receives and its valuation.

Spinner
DataFrameas
df
variable
SELECT * FROM public.companies INNER JOIN public.funding USING(company_id)
import plotly.express as px 
px.scatter(df, x = "funding", y="valuation", log_x=True, log_y=True, hover_name='company')
  • There seems to be a positive correlation between funding and valuation.
  • There are some companies for which valuation > funding.
#Chatgtp generated exampple for data manupilation using panada lib
import pandas as pd

# Create a DataFrame
df = pd.DataFrame({
  'Name': ['Alice', 'Bob', 'Charlie', 'Dave'],
  'Age': [25, 32, 18, 47],
  'Gender': ['F', 'M', 'M', 'M']
})

# Print the entire DataFrame
print(df)

# Select rows based on a condition
young_people = df[df['Age'] < 30]
print(young_people)

# Add a new column based on existing columns
df['Full Name'] = df['Name'] + ' Smith'
print(df)

# Group rows based on a column and aggregate another column
age_group_totals = df.groupby('Age')['Name'].count()
print(age_group_totals)

# Sort rows based on a column
df_sorted = df.sort_values('Age')
print(df_sorted)

# Drop a column
df_dropped = df.drop('Gender', axis=1)
print(df_dropped)
Open the video in a new tab