BLACK FRIDAY SPECIAL - GET 50% OFF ALL COURSES - LIMITED TIME OFFER!!!

Recreate Tesla Cybertruck in Matplotlib - Dunder Data Challenge #6 Solution

dunder data challenges Dec 10, 2019
 

In this post, we recreate the new Tesla Cybertruck using matplotlib and animate it so that it drives. Our goal is to recreate this image below.

Click the video at the top of this post to view the animation and final solution.

Begin Mastering Data Science Now for Free!

Take my free Intro to Pandas course to begin your journey mastering data analysis with Python.

Tutorial

A tutorial will now follow that describes the recreation. It will discuss the...

Continue Reading...

Dunder Data Challenge #6 — Recreate the Tesla Cybertruck with Matplotlib

dunder data challenges Nov 26, 2019

In this challenge, you will recreate the Tesla Cybertruck unveiled last week using matplotlib. All challenges are available to be completed in your browser in a Jupyter Notebook now thanks to Binder (mybinder.org).

Challenge

Use matplotlib to recreate the Tesla Cybertruck image above.

Extra Challenge

Add animation so that it drives off the screen.

I’m still working on this challenge myself. My current recreation is below:

 

Become a pandas...

Continue Reading...

Dunder Data Challenge #5 Solution

dunder data challenges Nov 25, 2019

This post presents a solution to Dunder Data Challenge #5 — Keeping Values Within the Interquartile Range.

All challenges may be worked in a Jupyter Notebook right now thanks to Binder (mybinder.org).

Solution

We begin by finding the first and third quartiles of each stock using the quantile method. This is an aggregation which returns a single value for each column by default. Set the first parameter, q to a float between 0 and 1 to...

Continue Reading...

Dunder Data Challenge #5 — Keeping Values Within the Interquartile Range

dunder data challenges Nov 14, 2019

In this challenge, you are given a table of closing stock prices for 10 different stocks with data going back as far as 1999. For each stock, calculate the interquartile range (IQR). Return a DataFrame that satisfies the following conditions:

  • Keep values as they are if they are within the IQR
  • For values lower than the first quartile, make them equal equal to the exact value of the first quartile
  • For values higher than the third quartile, make them equal equal to the exact value of the...
Continue Reading...

Dunder Data Challenge #4 - Solution

dunder data challenges Nov 13, 2019

In this post, I detail the solution to Dunder Data Challenge #4 — Finding the Date of the Largest Percentage Stock Price Drop.

Solution

To begin, we need to find the percentage drop for each stock for each day. pandas has a built-in method for this called pct_change. By default, it finds the percentage change between the current value and the one immediately above it. Like most DataFrame methods, it treats each column independently from the others.

If we call it on our current...

Continue Reading...

Dunder Data Challenge #4 - Finding the Date of the Largest Percentage Stock Price Drop

dunder data challenges Nov 12, 2019

In this challenge, you are given a table of closing stock prices for 10 different stocks with data going back as far as 1999. For each stock, find the date where it had its largest one-day percentage loss.

Begin working this challenge now in a Jupyter Notebook with Binder

Begin working this challenge now in a Jupyter Notebook thanks to Binder (mybinder.org). The data is found in the stocks10.csv file with the ticker symbol as a column name. The Dunder Data Challenges Github...

Continue Reading...

Dunder Data Challenge #3 - Optimal Solution

dunder data challenges Sep 17, 2019

In this article, I will present an ‘optimal’ solution to Dunder Data Challenge #3. Please refer to that article for the problem setup. Work on this challenge directly in a Jupyter Notebook right now by clicking this link.

Naive Solution — Custom function with apply

The naive solution was presented in detail in the previous article. The end result was a massive custom function containing many boolean filters used to find specific subsets of data to...

Continue Reading...

Dunder Data Challenge #3 - Naive Solution

dunder data challenges Sep 12, 2019

To view the problem setup, go to the Dunder Data Challenge #3 post. This post will contain the solution.

Master Data Analysis with Python

Master Data Analysis with Python is an extremely comprehensive course that will help you learn pandas to do data analysis.

I believe that it is the best possible resource available for learning how to data analysis with pandas and provide a 30-day 100% money back guarantee if you are not satisfied.

Solution

I will first present a naive solution that...

Continue Reading...

Dunder Data Challenge #3 - Multiple Custom Grouping Aggregations

dunder data challenges Sep 09, 2019

Welcome to the third edition of the Dunder Data Challenge series designed to help you learn python, data science, and machine learning. Begin working on any of the challenges directly in a Jupyter Notebook courtesy of Binder (mybinder.org).

This challenge is going to be fairly difficult, but should answer a question that many pandas users face — What is the best way to perform a groupby that does many custom aggregations? In this context, a ‘custom...

Continue Reading...

Dunder Data Challenge #2 - Explain the 1,000x Speed Difference when taking the Mean

dunder data challenges Sep 08, 2019

Welcome to the second edition of the Dunder Data Challenge series designed to help you learn python, data science, and machine learning. Begin working on any of the challenges directly in a Jupyter Notebook courtesy of Binder (mybinder.org).

In this challenge, your goal is to explain why taking the mean of the following DataFrame is more than 1,000x faster when setting the parameter   numeric_only to True

Learn Data Science with Python

I have...

Continue Reading...
1 2
Close

Register for a free account

Upon registration, you'll get access to four free courses.