Skip to content
Microfocus

Microfocus

Mad about business

Primary Menu Microfocus

Microfocus

  • Business Owner
  • Business Ideas
  • Business News
  • Business Law‎
  • Business Economics
  • Real estate
  • About Us
    • Advertise Here
    • Contact Us
    • Sitemap
    • Privacy Policy
  • Home
  • Ballpark figures: Analyzing MLB baseball attendance
  • Business Owner

Ballpark figures: Analyzing MLB baseball attendance

Malik Runswick May 14, 2022

[ad_1]

It is springtime in the U.S., which means something as American as apple pie is back: baseball. And since there’s all kinds of great data around one of the country’s great pastimes, we decided for this week’s post to look at Major League Baseball (MLB) attendance statistics from the last 20 years, which is published on many websites including the one we used to get the data you’ll find in the charts below: ESPN.com.

To collect the attendance data from ESPN, we used Jupyter Workspaces (currently in beta in Domo) and the Python package Beautiful Soup to parse the HTML. And since Domo can now schedule code in Jupyter Workspaces to run on a regular schedule, you can be sure that this page will continue to update with the 2022 data.

The first thing you’ll probably notice when looking at the data is that 2020 is missing. That’s because, due to the pandemic, baseball was played without fans that year. There was a bit of a return to normalcy in 2021, but it wasn’t until this season that all spectating restrictions were lifted, so it will be interesting to watch how attendance rebounds (though, in full transparency, we only have the data for full years right now, so we are not capturing any data related to seasonality, such as how weather or a team’s place in the playoff race affects ticket sales).

One good way to review this data is with an old favorite of many data scientists: a box and whisker plot. The chart shows the minimum and maximum average attendance for each team in the whiskers (the top and bottom lines). I have sorted this to show the team with the highest peak attendance year on the left, and the lowest on the right:

Where the visualization gets more interesting for me is with the box elements. Each box shows the space between 25th and 75th percentiles, which is meant to reflect how much a team’s attendance has swung over the years. The bigger boxes tell me those teams (such as Philadelphia and Detroit) have had some great years for attendance and some not so great years. Smaller boxes (such as Boston) say that a team has been very consistent in its attendance numbers. We have also filtered the chart for pre-pandemic years only since 2021 (and to a lesser extent partial 2022 data) skews the data.

An alternative approach to understanding how teams rank in attendance is to create indexes of where a team’s attendance stands relative to the total MLB average—which is what we’ve done directly below. Dark blue boxes mean that a team is well above the average, while dark orange boxes mean that a team is well below the average. You can use the filters to look at whatever league, division, team(s), or year(s) you’re interested in:

Long-time Domo users may be looking at these indexes and thinking that I did some pre-calculation in a Magic ETL or a Dataset View. It’s true that doing calculations on such total levels typically require pre-calculation. But if I did that, it would be hard to allow for the year filter. So, the secret is out: With Domo’s new FIXED beast modes (currently in beta), you can do FIXED level of detail functions right in a beast mode. For the above “Index to League Avg”, this is the calculation:

You can see there are two things happening here. First, when I have the SUM FIXED by League, then it is summing across all values with the same league as the row I am on. That allows me to get that league total we need for the denominator of the index. Second, it is using FILTER ALLOW to tell Domo that filters on Year can impact the FIXED functions.  There are options for FILTER ALLOW, FILTER DENY, and FILTER NONE.

Here’s one last example of how useful the FIXED with FILTER DENY can be. The bar charts below are defaulted to the New York Yankees (my boss’ favorite team). The first chart is not using FIXED, so when I filter for the Yankees, the Min, Max, and Median fields become meaningless since they get filtered to be the same as the selected team. The second chart uses FIXED and DENY on team name so that the Min, Max, and Median remain as references to the main average, which is for the Yankees.

One of the things I love—and also at times find maddening—about exploring new data is that there is always more to explore. As I worked on this post, I realized that it would be quite interesting to bring in teams’ win/loss records as well as information on stadium capacity. But then I thought: Let’s maybe save that for a future post.




[ad_2]

Source link

Post navigation

Previous: Ownership succession options for small business owners merger
Next: India bans wheat exports to deepen global food crisis

More Stories

How to Maximize Efficiency as a Business Owner
  • Business Owner

How to Maximize Efficiency as a Business Owner

Malik Runswick June 5, 2025
Top Tips Every Business Owner Should Know
  • Business Owner

Top Tips Every Business Owner Should Know

Malik Runswick May 11, 2025
Biden vs. Trump 2024: Who Has the Edge in Approval Ratings?
  • Business Owner

Biden vs. Trump 2024: Who Has the Edge in Approval Ratings?

Malik Runswick April 25, 2025
September 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  
« Aug    

Archives

Categories

  • Business Economics
  • Business Ideas
  • Business Law‎
  • Business News
  • Business Owner
  • Education‎
  • General
  • health
  • Medical
  • Real estate
  • Small Businesses

Recent Posts

  • Dive Bomb Gear That Makes Long Hunts Comfortable
  • Understanding Process Serving: A Vital Part of the Legal System
  • Daily Business News Digest: What’s Happening Now
  • How to Boost Your Home’s Value in Real Estate
  • How Business Economics Drives Company Growth

Fiverr

Fiverr Logo

Tags

Amazon Business Login Amazon Business Prime Bank Of America Business Account Best Business Schools Business Business Attorney Near Me Business Bank Account Business Card Holder Business Card Maker Business Cards Near Me Business Card Template Business Casual Attire Business Casual Shoes Business Casual Woman Business Plan Examples Ca Business Search Capital One Business Credit Card Ca Sos Business Search Chase Business Checking Chase Business Credit Cards Chase Business Customer Service Chase Business Login Chase Business Phone Number Cheap Business Cards Citizens Business Bank Cox Business Login Digital Business Card Facebook Business Suite Finance In Business Free Business Cards Google Business Login Harvard Business School Lands End Business Massage Parlor Business Near Me Michigan Business Entity Search Mind Your Business Mind Your Own Business Ohio Business Search Risky Business Costume Skype For Business Small Business Loan Small Business Saturday 2021 Starting A Business Texas Business Entity Search Triumph Business Capital
carrisen
masjiddarussalampnp

pondok

luxwearing
roseliana

You may have missed

Dive Bomb Gear That Makes Long Hunts Comfortable
  • Real estate

Dive Bomb Gear That Makes Long Hunts Comfortable

Malik Runswick September 2, 2025
Understanding Process Serving: A Vital Part of the Legal System
  • Business Law‎

Understanding Process Serving: A Vital Part of the Legal System

Malik Runswick August 20, 2025
Daily Business News Digest: What’s Happening Now
  • Business News

Daily Business News Digest: What’s Happening Now

Malik Runswick July 15, 2025
How to Boost Your Home’s Value in Real Estate
  • Real estate

How to Boost Your Home’s Value in Real Estate

Malik Runswick July 13, 2025
How Business Economics Drives Company Growth
  • Business Economics

How Business Economics Drives Company Growth

Malik Runswick July 11, 2025
Copyright © All rights reserved. | CoverNews by AF themes.

WhatsApp us