Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Python Business Intelligence Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
Python Business Intelligence Cookbook

Python Business Intelligence Cookbook

By : Dempsey
3.6 (9)
close
close
Python Business Intelligence Cookbook

Python Business Intelligence Cookbook

3.6 (9)
By: Dempsey

Overview of this book

The amount of data produced by businesses and devices is going nowhere but up. In this scenario, the major advantage of Python is that it's a general-purpose language and gives you a lot of flexibility in data structures. Python is an excellent tool for more specialized analysis tasks, and is powered with related libraries to process data streams, to visualize datasets, and to carry out scientific calculations. Using Python for business intelligence (BI) can help you solve tricky problems in one go. Rather than spending day after day scouring Internet forums for “how-to” information, here you’ll find more than 60 recipes that take you through the entire process of creating actionable intelligence from your raw data, no matter what shape or form it’s in. Within the first 30 minutes of opening this book, you’ll learn how to use the latest in Python and NoSQL databases to glean insights from data just waiting to be exploited. We’ll begin with a quick-fire introduction to Python for BI and show you what problems Python solves. From there, we move on to working with a predefined data set to extract data as per business requirements, using the Pandas library and MongoDB as our storage engine. Next, we will analyze data and perform transformations for BI with Python. Through this, you will gather insightful data that will help you make informed decisions for your business. The final part of the book will show you the most important task of BI—visualizing data by building stunning dashboards using Matplotlib, PyTables, and iPython Notebook.
Table of Contents (7 chapters)
close
close
6
Index

Creating a Pandas DataFrame from an Excel file


While many people will tell you to get data out of Excel as quickly as you can, Pandas provides a function to import data directly from Excel files. This saves you the time of converting the file.

How to do it…

  1. To create a Pandas DataFrame from an Excel file, first import the Python libraries that you need:

    import pandas as pd
  2. Next, define a variable for the accidents data file and enter the full path to the data file:

    customer_data_file = 'customer_data.xlsx'
  3. After that, create a DataFrame from the Excel file using the read_excel method provided by Pandas, as follows:

    customers = pd.read_excel(customer_data_file,
    sheetname=0,
    header=0,
    index_col=False,
    keep_default_na=True
    )
  4. Finally, use the head() command on the DataFrame to see the top five rows of data:

    customers.head()

How it works…

After importing Pandas and creating a variable from the path to our Excel file, we use the read_excel() function to create a DataFrame from the spreadsheet. The first...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Python Business Intelligence Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon