Project Overview

This report provides a descriptive analysis of the Minority and Women’s Business Enterprises (MBE/WBE) Certification dataset. The dataset contains information about businesses, including certification types, business categories, certification dates, certification statuses, and geographic locations.

The purpose of this analysis is to better understand how business certification records are distributed across different years, certification types, industries, and locations. The report also compares certification records over time and looks at the geographic distribution of businesses in the Baltimore area.

For this analysis, I used Python to prepare the data and create five different visualizations: a scatterplot, dual-axis bar chart, nested pie chart, waterfall diagram, and geographic map.

Data Source: Open Baltimore - Minority and Women’s Business Enterprises (MBE/WBE) Certification Data

Data Preparation

The MBE/WBE Certification dataset contains 13,455 records and 39 original columns. The data provides information about business certification types, business categories, certification status, original certification dates, and business locations.

Before creating my visualizations, I reviewed the dataset to better understand the information available. I focused on the number of records, certification types, business categories, and certification statuses.

# -------------------- Import Required Libraries --------------------

# Pandas and NumPy to work with the dataset
import pandas as pd
import numpy as np

# Matplotlib to create visualizations
import matplotlib.pyplot as plt

# Plotly for the waterfall diagram
import plotly.graph_objects as go

# Folium for the geographic map
import folium

# -------------------- Import the Dataset --------------------

# Load the MBE/WBE Certification dataset
df = pd.read_csv("Minority_and_Women_s_Business_Enterprises_(MBE_WBE)_Certification_Data.csv")

# Display the first five rows
df.head()

# -------------------- Review the Dataset --------------------

# Check the number of rows and columns
print(df.shape)

# Display the column names
print(df.columns.tolist())

The first step was importing the Python libraries needed for my analysis. I used Pandas and NumPy to work with the dataset, Matplotlib to create charts, Plotly for the waterfall diagram, and Folium for the geographic map.

After importing the dataset, I used head() to preview the first five rows and shape to check the number of records and columns. I also reviewed the column names to understand what information was available.

Data Cleaning

# -------------------- Prepare Certification Dates --------------------

# Convert original certification dates into a date format
df['user_origcert'] = pd.to_datetime(df['user_origcert'],errors='coerce')

# Extract the year from the certification date
df['year'] = df['user_origcert'].dt.year

# Extract the month from the certification date
df['month'] = df['user_origcert'].dt.month

# Updated date information
df[['user_origcert', 'year', 'month']].head()

The data preparation process involved converting the original certification dates into a format that Python could recognize. I then created new columns for the certification year and month.

These new columns helped me organize the data by time and were used later to create the scatterplot and waterfall diagram.

Basic Descriptive Statistics

# -------------------- Basic Descriptive Statistics --------------------

# Total number of records
print("Total records:", len(df))

# The number of unique business names
print("Unique businesses:", df['user_company'].nunique())

# Count the records for each certification type
print("\nCertification Types:")
print(df['user_contracttype'].value_counts())

# Count the records for each business category
print("\nBusiness Categories:")
print(df['user_category'].value_counts())

# Count the records for each certification status
print("\nCertification Status:")
print(df['user_contractstatus'].value_counts())

# Display the numerical summary
print("\nNumerical Summary:")
print(df.describe())
Basic Descriptive Statistics of the MBE/WBE Dataset
Statistic Value
Total Certification Records 13,455
Unique Business Names 5,621
Original Dataset Columns 39
MBE Records 8,476
WBE Records 2,815
M/WBE Records 2,164
Construction Records 4,871
Professional Services Records 4,815
Services Records 2,678
Commodities Records 919
Manufacturing Records 78
Missing Business Category 94

The dataset contains 13,455 records and 39 original columns. Based on the business-name column, there are 5,621 unique business names represented in the dataset.

MBE has the highest number of certification records, with 8,476 records. WBE follows with 2,815 records, while M/WBE has 2,164 records.

Construction and Professional Services are the two largest business categories, with 4,871 and 4,815 records, respectively. The dataset also contains businesses in Services, Commodities, and Manufacturing.

These descriptive statistics provide a basic understanding of the dataset before looking at the five visualizations.

Visualization 1: Original MBE/WBE Certifications by Year

# -------------------- Visualization 1: Scatterplot --------------------

# Group records by original certification year
scatter_df = df.groupby('year').size().reset_index(name='count')

# Create the scatterplot
fig = plt.figure(figsize=(14, 8))
ax1 = fig.add_subplot(1, 1, 1)

# Plot the number of records for each year
ax1.scatter(
    scatter_df['year'],
    scatter_df['count'],
    color='steelblue',
    edgecolor='black',
    s=100,
    alpha=0.7)

# Add the title and axis labels
ax1.set_title('Original MBE/WBE Certifications by Year', fontsize=18, fontweight='bold')

ax1.set_xlabel('Year of Original Certification', fontsize=13)
ax1.set_ylabel('Number of Certification Records', fontsize=13)

# Add gridlines
ax1.grid(True, linestyle='--', alpha=0.4)

# Adjusting the layout and saving the graph
plt.tight_layout()
plt.savefig('MBE_WBE_Scatterplot.png', dpi=300, bbox_inches='tight')
plt.show()

The scatterplot shows the number of original certification records by year. The X-axis represents the year of original certification, while the Y-axis shows the number of records associated with each year.

Based on the visualization, the number of records changes throughout the years. The highest number appears in 2017, with 830 records. Another noticeable year is 2009, with 756 records. There are also years with much lower counts, particularly toward the end of the period.

Overall, this visualization shows that original certification records are not evenly distributed across the years. However, the counts represent records in the dataset and should not be interpreted as the total number of certifications officially issued each year.

Visualization 2: Certification Records and Certify Status

# -------------------- Visualization 2: Dual-Axis Bar Chart --------------------

# Count the total records for each certification type
dual_df = df.groupby('user_contracttype').size().reset_index(name='count')

# Select records with Certify status
certify_df = df[df['user_contractstatus'] == 'CERTIFY']

# Count Certify records for each certification type
certify_df = certify_df.groupby('user_contracttype').size().reset_index(name='certify_count')

# Combine the total counts and CERTIFY counts
dual_df = dual_df.merge(certify_df, on='user_contracttype', how='left')

# Replace missing values with zero
dual_df['certify_count'] = dual_df['certify_count'].fillna(0)

# Calculate the percentage of records marked Certify
dual_df['certify_pct'] = (dual_df['certify_count'] / dual_df['count']) * 100

# Create the chart and two Y-axes
fig = plt.figure(figsize=(14, 8))
ax1 = fig.add_subplot(1, 1, 1)
ax2 = ax1.twinx()

# Set the bar width and positions
bar_width = 0.4
x_pos = np.arange(len(dual_df))

# Create gray bars for total certification records
count_bars = ax1.bar(
    x_pos - 0.5 * bar_width,
    dual_df['count'],
    width=bar_width,
    color='gray',
    edgecolor='black',
    label='Certification Records')

# Create blue bars for Certify percentages
certify_bars = ax2.bar(
    x_pos + 0.5 * bar_width,
    dual_df['certify_pct'],
    width=bar_width,
    color='steelblue',
    edgecolor='black',
    label='CERTIFY Status (%)')

# Add the title and axis labels
ax1.set_title('MBE/WBE Certification Records and CERTIFY Status Percentage', fontsize=17, fontweight='bold', pad=20)
ax1.set_xlabel('Certification Type', fontsize=13)
ax1.set_ylabel('Number of Records', fontsize=13)
ax2.set_ylabel('CERTIFY Status (%)', fontsize=13)

# Display certification types on the X-axis
ax1.set_xticks(x_pos)
ax1.set_xticklabels(dual_df['user_contracttype'], fontsize=12)

# Display values above the bars
ax1.bar_label(count_bars, padding=3, fmt='%.0f')
ax2.bar_label(certify_bars, padding=3, fmt='%.1f%%')

# Add legends
ax1.legend(loc='upper left')
ax2.legend(loc='upper right')

# Add gridlines
ax1.grid(axis='y', linestyle='--', alpha=0.3)
ax1.set_axisbelow(True)

# Adjust layout and save the chart
plt.tight_layout()
plt.savefig('MBE_WBE_Dual_Axis_Bar_Chart.png', dpi=300, bbox_inches='tight')
plt.show()

The dual-axis bar chart compares the total number of certification records with the percentage of records marked CERTIFY for each certification type. The gray bars represent the total number of records using the left Y-axis, while the blue bars represent the percentage marked CERTIFY using the right Y-axis.

MBE has the highest number of records, with 8,476, followed by WBE with 2,815 and M/WBE with 2,164. However, WBE has the highest percentage of records marked CERTIFY at approximately 17.9%, compared with 13.0% for M/WBE and 10.6% for MBE.

This visualization shows that having a larger number of certification records does not necessarily mean having a higher percentage of records marked CERTIFY. It also helps compare two different measurements across the same certification types.

Visualization 3: Distribution of Certification Types and Business Categories

# -------------------- Visualization 3: Nested Pie Chart --------------------

from matplotlib.patches import Patch

# Create a copy of the original dataset
pie_df = df.copy()

# Group the business categories
pie_df['category_group'] = pie_df['user_category'].replace({'CONSTRUCTION': 'Construction','PROF SERVICES': 'Professional Services','SERVICES': 'Services'})

# Combine smaller categories into Other
pie_df['category_group'] = pie_df['category_group'].where(pie_df['category_group'].isin(['Construction','Professional Services','Services']),'Other')

# Count records by certification type and business category
pie_summary = pie_df.groupby(['user_contracttype', 'category_group']).size().reset_index(name='count')

# Arrange the certification types and categories
type_order = ['M/WBE', 'MBE', 'WBE']

category_order = ['Construction', 'Professional Services', 'Services', 'Other']

# Create a table of record counts
pie_table = pie_summary.pivot(index='user_contracttype', columns='category_group', values='count').fillna(0)

pie_table = pie_table.reindex(index=type_order, columns=category_order, fill_value=0)

# Values for outer and inner rings
outer_values = pie_table.sum(axis=1).values
inner_values = pie_table.values.flatten()

# Colors for each certification type
outer_colors = ['steelblue', 'seagreen', 'darkorange']

blue_colors = plt.cm.Blues(np.linspace(0.4, 0.85, 4))
green_colors = plt.cm.Greens(np.linspace(0.4, 0.85, 4))
orange_colors = plt.cm.Oranges(np.linspace(0.4, 0.85, 4))

inner_colors = np.vstack([blue_colors, green_colors, orange_colors])

# Create the figure
fig, ax = plt.subplots(figsize=(15, 11))

# Calculate the total number of records
total_records = int(sum(outer_values))

# Format outer ring percentages and record counts
def outer_format(pct):
    count = round(pct * total_records / 100)
    return f'{pct:.2f}%\n({count:,} records)'

# Create the outer ring for certification types
outer_wedges, outer_texts, outer_autotexts = ax.pie(
    outer_values,
    radius=1.0,
    labels=type_order,
    colors=outer_colors,
    startangle=90,
    counterclock=False,
    autopct=outer_format,
    pctdistance=0.84,
    labeldistance=1.13,
    wedgeprops=dict(width=0.29, edgecolor='white'),
    textprops=dict(fontsize=11))

# Format the outer percentage labels
for text in outer_autotexts:
    text.set_fontsize(10)
    text.set_fontweight('bold')

# Create the inner ring for business categories
inner_wedges, inner_texts = ax.pie(
    inner_values,
    radius=0.70,
    colors=inner_colors,
    startangle=90,
    counterclock=False,
    wedgeprops=dict(width=0.30, edgecolor='white'))

# Shorten category names
short_categories = ['Const.', 'Prof. Serv.', 'Services', 'Other']

inner_labels = short_categories * len(type_order)

# Add category labels and percentages to larger sections
for i, wedge in enumerate(inner_wedges):

    pct = (inner_values[i] / total_records) * 100

    if pct >= 4:
        angle = (wedge.theta1 + wedge.theta2) / 2
        angle_rad = np.deg2rad(angle)

        x1 = 0.62 * np.cos(angle_rad)
        y1 = 0.62 * np.sin(angle_rad)

        ax.text(x1, y1, inner_labels[i], ha='center', va='center', fontsize=8)

        x2 = 0.47 * np.cos(angle_rad)
        y2 = 0.47 * np.sin(angle_rad)

        ax.text(x2, y2, f'{pct:.2f}%', ha='center', va='center', fontsize=9)

# Add a white circle in the center
center_circle = plt.Circle((0, 0), 0.39, color='white')
ax.add_artist(center_circle)

# Display total records in the center
ax.text(0, 0.06, 'Total Records', ha='center', va='center', fontsize=13, fontweight='bold')

ax.text(0, -0.07, f'{total_records:,}', ha='center', va='center', fontsize=16, fontweight='bold')

# Add the chart title
ax.set_title('MBE/WBE Certification Types and Business Categories', fontsize=18, fontweight='bold', pad=25)

# Create the legend
legend_labels = [f'{cert_type} - {category}' for cert_type in type_order for category in category_order]

legend_handles = [Patch(facecolor=color, label=label) for color, label in zip(inner_colors, legend_labels)]

ax.legend(handles=legend_handles, title='Business Categories', loc='center left', bbox_to_anchor=(1.05, 0.5), fontsize=9)

# Keep the chart circular
ax.set_aspect('equal')

# Save and display the chart
plt.tight_layout()
plt.savefig(
    'MBE_WBE_Nested_Pie_Chart.png',
    dpi=300,
    bbox_inches='tight')
plt.show()

The nested pie chart shows the distribution of certification records by certification type and business category. The outer ring represents the three certification types, while the inner ring breaks each type down into different business categories.

MBE represents the largest share of records at 63.00%, with 8,476 records. WBE follows with 20.92%, or 2,815 records, while M/WBE represents 16.08%, or 2,164 records.

Within MBE, Construction represents 28.45% of the entire dataset, followed by Professional Services at 17.65%. These are two of the largest individual business-category sections.

Overall, this visualization helps show how the certification records are divided among different industries and highlights which certification types and business categories are most represented.

Visualization 4: Monthly Certification Records Compared to 2016

The fourth visualization uses a waterfall diagram to compare original certification records in 2017 with the average monthly number of records from 2016. I selected 2017 because it has the highest number of original certification records in the dataset.

The purpose of this visualization is to understand which months contributed to the overall difference between 2016 and 2017.

# -------------------- Visualization 4: Plotly Waterfall Diagram --------------------

# Convert original certification dates into a date format
df['user_origcert'] = pd.to_datetime(df['user_origcert'], errors='coerce')

# Extract the year and month
df['year'] = df['user_origcert'].dt.year
df['month'] = df['user_origcert'].dt.month

# Select records from 2017
wf_df = df[df['year'] == 2017]

# Count original certification records for each month
wf_df = wf_df.groupby('month').size().reset_index(name='total_records')

# Calculate the average monthly number of records from 2016
benchmark = len(df[df['year'] == 2016]) / 12

# Add the benchmark to the dataframe
wf_df['benchmark'] = benchmark

# Calculate the difference between monthly records and benchmark
wf_df['deviation'] = (wf_df['total_records'] - wf_df['benchmark'])

# Convert month numbers into month names
wf_df['month_name'] = pd.to_datetime(wf_df['month'], format='%m').dt.strftime('%b')

# Calculate the total difference
total_deviation = wf_df['deviation'].sum()

# Add a total row
total_row = pd.DataFrame({'month': [13], 'total_records': [wf_df['total_records'].sum()], 'benchmark': [wf_df['benchmark'].sum()],'deviation': [total_deviation], 'month_name': ['Total']})

# Combine monthly data with the total row
wf_df = pd.concat([wf_df, total_row], ignore_index=True)

# -------------------- Create the Waterfall Diagram --------------------

# Create a Plotly figure
fig = go.Figure()

# Add the waterfall chart
fig.add_trace(go.Waterfall(name='Certification Records', orientation='v',

    # Display months on the X-axis
    x=wf_df['month_name'],

    # Display the difference from the benchmark
    y=wf_df['deviation'],

    # Show monthly changes and final total
    measure=['relative'] * 12 + ['total'],

    # Set colors for positive, negative, and total bars
    increasing=dict(marker=dict(color='seagreen')),
    decreasing=dict(marker=dict(color='indianred')),
    totals=dict(marker=dict(color='steelblue')),

    # Add lines connecting the bars
    connector=dict(line=dict(color='gray', width=1)),

    # Display values on the bars
    text=[f'{value:+.1f}' for value in wf_df['deviation'][:12]] + [f'{total_deviation:+.0f}'], textposition='outside'))

# Add the chart title and axis labels
fig.update_layout(
    title='Monthly MBE/WBE Certification Records Compared to 2016 Benchmark',
    xaxis_title='Month (2017)',
    yaxis_title='Cumulative Difference in Certification Records',
    showlegend=False,
    width=1100,
    height=650,
    waterfallgap=0.3)

# Display the waterfall diagram
fig.show()

# Save the interactive HTML version
fig.write_html('MBE_WBE_Waterfall.html')

# Save the image version
fig.write_image('MBE_WBE_Waterfall.png', width=1200, height=700, scale=2)

The waterfall diagram compares monthly original certification records from 2017 with the average monthly number of records from 2016. Green bars represent months with more records than the benchmark, while red bars represent months with fewer records. The blue bar shows the overall difference between the two years.

October had the largest positive difference at approximately 138.4 records above the monthly benchmark, followed by March at approximately 113.4 records. February had the largest negative difference at approximately 16.6 records below the benchmark.

This visualization helps show how individual months contributed to the overall difference between the two years. However, these figures represent records contained in the dataset rather than the official number of certifications issued each year.

Visualization 5: Geographic Distribution of MBE/WBE Businesses

# -------------------- Visualization 5: Geographic Map --------------------

# Create a dataframe with the information needed for the map
map_df = df[['user_company', 'user_contracttype', 'city', 'state', 'x','y']].copy()

# Convert coordinates into numerical values
map_df['x'] = pd.to_numeric(map_df['x'], errors='coerce')
map_df['y'] = pd.to_numeric(map_df['y'], errors='coerce')

# Remove records with missing coordinates
map_df = map_df.dropna(subset=['x', 'y'])

# Remove zero coordinates
map_df = map_df[(map_df['x'] != 0) & (map_df['y'] != 0)].copy()

# -------------------- Convert Latitude and Longitude --------------------

# Convert the projected coordinates into longitude and latitude
R = 6378137

map_df['longitude'] = np.degrees(map_df['x'] / R)

map_df['latitude'] = np.degrees(2 * np.arctan(np.exp(map_df['y'] / R)) - np.pi / 2)

# Keep coordinates within the selected geographic range
map_df = map_df[map_df['latitude'].between(38, 40) & map_df['longitude'].between(-80, -75)].copy()

# Remove repeated combinations
map_df = map_df.drop_duplicates( subset=['user_company', 'user_contracttype', 'latitude', 'longitude'])

# Reset the index
map_df = map_df.reset_index(drop=True)

# -------------------- Select Business Locations --------------------

# Select up to 1,000 locations for the map
map_sample = map_df.sample(n=min(1000, len(map_df)), random_state=42)

# -------------------- Create the Folium Map --------------------

# Center the map around Baltimore
center_of_map = [39.2904, -76.6122]

my_map = folium.Map(
    location=center_of_map,
    zoom_start=10,
    width='100%',
    height=600,
    tiles='OpenStreetMap')

# Assign colors to certification types
color_map = {'MBE': 'blue', 'WBE': 'orange', 'M/WBE': 'green'}

# Add business locations to the map
for index, row in map_sample.iterrows():

    marker_color = color_map.get(row['user_contracttype'], 'gray')

    folium.CircleMarker(location=[row['latitude'],row['longitude']],
        radius=4,
        color=marker_color,
        fill=True,
        fill_color=marker_color,
        fill_opacity=0.6,
        weight=1,
        popup=(
            f"Company: {row['user_company']}<br>"
            f"Certification: {row['user_contracttype']}<br>"
            f"City: {row['city']}")).add_to(my_map)

# -------------------- Add Map Legend --------------------

legend_html = """
<div style="
position: fixed;
bottom: 30px;
left: 30px;
width: 180px;
background-color: white;
border: 2px solid gray;
z-index: 9999;
font-size: 14px;
padding: 10px;">

<b>Certification Type</b><br>
<span style="color:blue;">â—Ź</span> MBE<br>
<span style="color:orange;">â—Ź</span> WBE<br>
<span style="color:green;">â—Ź</span> M/WBE
</div>"""

my_map.get_root().html.add_child(folium.Element(legend_html))

# Interactive map as HTML
my_map.save('MBE_WBE_Geographic_Map.html')

# Display the map
my_map

The geographic map shows the locations of businesses included in the MBE/WBE Certification dataset. Each circle represents a sampled business certification location, with different colors representing the certification types. Blue markers represent MBE, orange markers represent WBE, and green markers represent M/WBE.

Based on the map, many of the sampled locations are concentrated in and around Baltimore. There are also businesses located in surrounding communities, including Towson, Cockeysville, and Dundalk.

The map helps show how business locations are distributed geographically. Since I used a sample of up to 1,000 locations, the map does not represent every business in the dataset.

Overall, this visualization provides a geographic perspective on the certification records and helps identify areas where the sampled businesses appear more concentrated.

Conclusion

This analysis shows how Minority and Women’s Business Enterprises (MBE/WBE) certification records vary across certification types, business categories, years, and geographic locations. The dataset contains 13,455 records, representing 5,621 unique business names.

The analysis found that MBE makes up the largest share of certification records at 63.0%, followed by WBE at 20.9% and M/WBE at 16.1%. Construction and Professional Services are also two of the most common business categories represented in the dataset.

The scatterplot showed that the number of original certification records changes across different years, with 2017 having the highest number of records. The dual-axis bar chart showed that even though MBE has the largest number of records, WBE has the highest percentage marked CERTIFY. The nested pie chart provided a closer look at how certification types are distributed across different industries.

The waterfall diagram showed that 2017 had 463 more original certification records than 2016, with March and October making some of the largest positive contributions. Finally, the geographic map showed that many of the sampled business locations are concentrated around Baltimore, with additional locations throughout surrounding communities.

Overall, these five visualizations helped me better understand the patterns in the MBE/WBE Certification dataset. They also demonstrated how different types of Python visualizations can be used to analyze business information and communicate findings more clearly. The results describe the records available in the dataset and do not necessarily represent every certification issued by the program.