Course

Introduction to Python for Data Analysis

Learn the basics of Python and Pandas

Course Sections
goals In this section, we'll learn how to:
  • Write our first line of code in Python
  • Create a simple dataset
  • Install and load the Pandas library

Welcome

Welcome to the course! We are glad you are here. Learning Python is one of the best ways you can work with data and create charts. Python is a free and open-source software and has helped many people get started in data analytics. We hope you will have fun along the way and learn a lot.

This course has 7 sections. Each section has a set of examples, exercises, self-assessments, and quizzes to help you learn. As you complete the self-assessments and quizzes, the course progress will get updated. By completing all the quizzes, you’ll earn a certificate of completion.

Sections in this course
    1. Introduction
    2. Selecting columns
    3. Visualizing data
    4. Filtering rows
    5. Summarizing & grouping data
    6. Creating columns
    7. Conclusion

What is Python and Pandas

Python is a versatile programming language widely used in data science, web development, and many other fields. It’s known for its simplicity and readability.

People extend Python by creating libraries. Pandas is a powerful library for data manipulation and analysis in Python, similar to the Tidyverse in R.

Your first line of code

The following code is interactive. You can run the code by clicking the run button. The code will print “Hello World!” in the console.

hello world

It’s your turn now. Type print("Hello World!") in the code editor below and click the run button.

hello world

Exploring an Example dataset

In this course, we’ll create a simple dataset and use it to learn Python and Pandas. This is a dataset of flowers with their names, height (centimeters), season, sunlight (hours), and growth rate.

nameheightseasonsunlightgrowth
Poppy75Spring8.3fast
Rose150Summer6.4slow
Zinnia60Summer8.7fast
Peony90Spring7.2slow

To create a DataFrame in Python using Pandas, we can use the pd.DataFrame() function.

 import pandas as pd
 
flowers = pd.DataFrame({
    'name': ['Poppy', 'Rose', 'Zinnia', 'Peony'],
    'height': [75, 150, 60, 90],
    'season': ['Spring', 'Summer', 'Summer', 'Spring'],
    'sunlight': [8.3, 6.4, 8.7, 7.2],
    'growth': ['fast', 'slow', 'fast', 'slow']
})
 
print(flowers) 

Try running the following code.

flowers

Installing and loading the Pandas library

To install the Pandas library, you need to run this command in your terminal or command prompt. You only need to do this once on your computer.

 pip install pandas
 

Now, whenever you are using Python and need to use Pandas, make sure to import the library by adding this line at the beginning of your script and running it.

 import pandas as pd 
summary We've learned how to
  • Print “Hello World!” in the console
  • Create a simple dataset using Pandas
  • Install and import the Pandas library
Self-assessment

    Loading...

    Loading...