Data Insights
Before creating any charts, it's important to understand the dataset being visualised. In this session, the dataset is organised as a company-year panel, meaning each row represents one company observed in one particular year. Panel data of this kind is extremely common in business and economics, since it allows you to compare organisations both across time and across groups, in ways a single snapshot of data never could.
The dataset includes sales, employee numbers, profit, sector, region, spending variables, and various performance indicators. Together, these variables make it possible to explore several genuinely interesting questions: are companies growing over time? Do larger firms generate more sales? Do profit margins differ meaningfully by sector? Is digital maturity associated with stronger performance?
At this stage, the goal isn't yet to draw firm conclusions. The first objective is simply to inspect the shape, columns, and overall structure of the data, so that any charts built later are correctly interpreted, rather than misread due to a misunderstanding about what each row or column actually represents.
Python Code: Loading and Inspecting the Dataset
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Load the synthetic business dataset supplied with the session
data = pd.read_csv("session_4_synthetic_business_dataset.csv")
# Inspect the first rows and the overall structure
print(data.head())
print(data.shape)
print(data.columns)
Expected output / interpretation
The output should show the first rows, the dimensions of the data, and the list of available columns.
What to look out for here: before trusting any chart built later in this session, it's worth confirming a few basics. Does data.shape show the number of rows you expect? Does data.columns include every variable mentioned in the introduction above, sales, employees, profit, sector, region, spending, and performance indicators? If a column is missing, misspelled, or unexpectedly named, it's far better to catch that now than several charts into the analysis.
Python Code: Understanding the Company-Year Structure
# The dataset has 10 companies observed over 10 years.
# Each row is one company-year observation.
print(data[["company", "sector", "year", "sales_million", "employees", "profit_million"]].head(12))
# Count observations by company
company_counts = data["company"].value_counts()
print(company_counts)
Expected output / interpretation
Each company should have 10 yearly observations, producing 100 observations in total.
Why this check matters: confirming that every company has exactly 10 years of data (rather than, say, 9 for one firm and 11 for another) is a small but genuinely important validation step for panel data specifically. An uneven number of observations per company could indicate a missing year, a duplicated row, or a company that joined or left the dataset partway through, any of which would need investigating before building trend charts in the next section, since an incomplete series can easily be mistaken for a genuine dip or gap in performance.
Setting up for what's ahead: notice that this section imports matplotlib.pyplot even though no chart is drawn yet. This is a deliberate habit worth adopting: importing all the libraries a script will need at the very top, before any analysis begins, keeps your code organised and makes it immediately obvious to anyone reading it (including your future self) what tools the rest of the script depends on.