3D Print Revit & IFC
1 August 2023
Install Jupyter Notebook
2 August 2023

Visualizing Data from Excel

The Challenge

In the construction and design sector, professionals grapple with vast Excel datasets. Deciphering these numbers is daunting, especially as Excel's basic visual tools often fall short. The real challenge is efficiently transforming this complex Excel data into clear and universally understandable visual narratives.

Requirements

Installing Python Guide

Installing Python

Why Python?

Python is an easy-to-learn, versatile programming language. It's the backbone of various data processing and machine learning libraries.

Steps to Install Python:

  1. Visit the official Python website.
  2. Click on the download link for the latest version of Python.
  3. Once downloaded, open the installer.
  4. IMPORTANT: Check the box that says "Add Python to PATH." This will allow you to run Python from the command prompt.
  5. Choose the "Install Now" option.
  6. Wait for the installation to complete and ensure there are no errors.

Verifying Installation:

  1. Open your command prompt or terminal.
  2. Type python --version and press Enter.
  3. You should see the version of Python you installed. This confirms that Python was installed successfully.

Note: The detailed instructions above are primarily for Windows users. If you're using macOS or Linux, Python may already be installed. If not, the installation process is similar, but the interface will be different. Always refer to official documentation or seek platform-specific guides when needed.

Installing Jupyter Notebook Guide

Installing Jupyter Notebook

Why Jupyter Notebook?

Jupyter Notebook is an open-source application that allows you to create and share documents containing live code, equations, visualizations, and narrative text. It's great for data cleaning and transformation, numerical simulation, statistical modeling, and more.

Steps to Install Jupyter Notebook:

  1. Ensure you have Python installed. Jupyter Notebook runs on Python.
  2. Open your command prompt or terminal.
  3. Type pip install notebook and press Enter to install Jupyter Notebook via pip, Python's package manager.
  4. After installation, you can start Jupyter Notebook by typing jupyter notebook in your terminal or command prompt.
  5. Your default web browser will open displaying the Jupyter Notebook interface. From here, you can create new notebooks or open existing ones.

Using Jupyter Notebook:

  1. Once the Jupyter interface is open in your browser, click on "New" and select "Python 3" to create a new notebook.
  2. You can now start writing and executing Python code in the notebook cells. You can also add markdown for notes.
  3. Always remember to save your work. You can download the notebook in various formats, including .ipynb (Jupyter's format) and .pdf.

Note: If you encounter any issues or want to explore more features, refer to the official Jupyter Notebook documentation.

  How It Works (Step-by-Step Pipeline)

1. Data opening

# Importing the necessary libraries 
# for data manipulation and plotting

import pandas as pd
import matplotlib.pyplot as plt

# Reading the Excel file into a DataFrame (df)
df = pd.read_excel('C:DDCConstruction-Budget.xlsx')

# Show DataFrame table 
df
2. Grouping and visualization
# Grouping by 'Category', summing 
# the 'Amount', plotting the results, and adjusting the layout

ax = df.groupby('Category')['Amount'].sum().plot(kind='bar', figsize=(10, 5), color='skyblue', title='Expenses by Category', ylabel='Amount', rot=45, grid=True).get_figure()
3. Export
# Specifying the path for saving 
# the figure and saving the plot as a PNG file

file_path = "C:DDCexpenses_by_category.png"

plt.savefig(file_path)

Full Code

import pandas as pd
import matplotlib.pyplot as plt

# Reading the "ITEMIZED EXPENSES" sheet
itemized_expenses_df = pd.read_excel("https://datadrivenconstruction.io/wp-content/uploads/2023/08/Home-Construction-Budget.xlsx", sheet_name="ITEMIZED EXPENSES")

# Display the first few rows of the dataframe for review
itemized_expenses_head = itemized_expenses_df.head()

import matplotlib.pyplot as plt

# Grouping the expenses by category and summing the amounts
category_expenses = itemized_expenses_df.groupby("Category")["Amount"].sum()

# Pie chart visualization
plt.figure(figsize=(10, 7))
category_expenses.plot(kind="pie", autopct='%1.1f%%', startangle=90)
plt.title("Distribution of Expenses by Category")
plt.ylabel("")  # Remove the default ylabel for a cleaner look
plt.show()

Frequently asked questions

Can I visualize multiple columns at once?

How can I customize the appearance of my plots?

My data is too large. How can I visualize it effectively?

Facing Issues? Reach Out!

Offer support for any troubleshooting or advanced use-cases

Every week, fresh solutions are released through our social channels

Don't miss the new solutions

Discover Ad-Free applications

with support for the latest CAD (BIM) formats

Don't miss the new solutions

 

 

Visualizing Data from Excel
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more


Subscribe now to get free discount coupon code. Don't miss out!
    SUBSCRIBE
    I agree with the term and condition