Intermediate Python for Data Science is crucial for any aspiring data science practitioner learning Python. Learn to visualize real data with Matplotlib's functions and get acquainted with data structures such as the dictionary and the pandas DataFrame. After covering key concepts such as boolean logic, control flow, and loops in Python, you'll be ready to blend together everything you've learned to solve a case study using hacker statistics.
Lead by Filip Schouwenaars, Data Science Instructor at DataCamp
Data visualization is a key skill for aspiring data scientists. Matplotlib makes it easy to create meaningful and insightful plots. In this chapter, you’ll learn how to build various types of plots, and customize them to be more visually appealing and interpretable.
- Line plot
import matplotlib.pyplot as plt
plt.plot(x,y)
plt.show()
- Scatter plot
plt.scatter(x,y)
plt.show()
- Histogram
plt.hist(life_exp, 5)
plt.show()
- Choose the right plot
- Customizations -- labels, ticks, colors, grid, etc.
Learn about the dictionary, an alternative to the Python list, and the pandas DataFrame, the de facto standard to work with tabular data in Python. You will get hands-on practice with creating and manipulating datasets, and you’ll learn how to access the information you need from these data structures.
Boolean logic is the foundation of decision-making in Python programs. Learn about different comparison operators, how to combine them with Boolean operators, and how to use the Boolean outcomes in control structures. You'll also learn to filter data in pandas DataFrames using logic.
There are several techniques you can use to repeatedly execute Python code. While loops are like repeated if statements, the for loop iterates over all kinds of data structures. Learn all about them in this chapter.
This chapter will allow you to apply all the concepts you've learned in this course. You will use hacker statistics to calculate your chances of winning a bet. Use random number generators, loops, and Matplotlib to gain a competitive edge!
- Generate random numbers
import numpy as np
np.random.seed(123)
print(np.random.rand())
print(np.random.randint(1,7))
- Random walk
- Visualize the walk
- Calculate the odds of climbing the Empire State Building (with clumsiness)