Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 291 additions & 0 deletions your-code/.ipynb_checkpoints/challenge-1-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Before you start :\n",
" - These exercises are related to the Exploratory data analysis using matplotlib and seaborn.\n",
" - Keep in mind that you need to use some of the functions you learned in the previous lessons.\n",
" - The datasets for Challenge 2 and 3 are provided in the `your-code` folder of this lab.\n",
" - Elaborate your codes and outputs as much as you can.\n",
" - Try your best to answer the questions and complete the tasks and most importantly enjoy the process!!!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Challenge 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Import all the libraries that are necessary."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\n%matplotlib inline\\n'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# import libraries here\n",
"import numpy as np\n",
"\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"'''\n",
"%matplotlib inline\n",
"'''"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Define data."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"x = np.arange(0,100)\n",
"y = x*2\n",
"z = x**2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Plot (x,y) and (x,z) on the axes.\n",
"\n",
"#### There are 2 ways of doing this. Do in both ways.\n",
"\n",
"*Hint: Check out the `nrows`, `ncols`, and `index` arguments of [subplots](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html)*\n",
"\n",
"#### Also, play around with the linewidth and style. Use the ones you're most happy with."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here-1st way (call `subplots` twice using the `index` parameter)\n",
"subplot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here-2st way (call `subplots` only once not using the `index` parameter)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Augmenting your previous code, resize your previous plot.\n",
"\n",
"*Hint: Add the `figsize` argument in `plt.subplots()`*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Augmenting your previous code, label your axes.\n",
"\n",
"*Hint: call `set_xlabel` and `set_ylabel`*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Plot both `y=x^2` and `y=exp(x)` in the same plot using normal and logarithmic scale.\n",
"\n",
"*Hint: Use `set_xscale` and `set_yscale`*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### In the vehicles data set that you have downloaded, use the vehicles.csv file. In this exercise we will conduct some exploratory data analysis using one plot each of scatter plot, box plot, histogram, and bar chart. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Scatter Plot\n",
"\n",
"Please provide a scatter plot between \"Combined MPG\" as X variable and \n",
"\"Highway MPG\" as Y variable"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Box Whisker Plot\n",
"\n",
"Please provide a box plot of the variable \"CO2 Emission Grams/mile\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Histogram\n",
"\n",
"Please provide a histogram of the Fuel Barrels/Year"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Bar Chart\n",
"\n",
"Please provide a bar chart of the Fuel Type on the X axis and \"City MPG\" on the Y axis"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading