All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
Read the stock data CSV files for Apple and Tesla, assign them to apple_df
and tesla_df
respectively, and ensure that the dates are parsed correctly.
Select the appropriate shape for the apple_df
and tesla_df
dataframes.
Create a new dataframe called tesla_column_df
by reading only the Date
and Close
columns from the Tesla stock data CSV file.
Read Apple stock data for March 2022 and store it in apple_row_df
dataframe.
Using apple_df
, what is the mean Close
price rounded to the nearest integer? Example, if the value is 90.182
, enter 90
. If it's 90.871
, enter 91
.
Select the correct mean for apple_df
and tesla_df
dataframes.
Find the maximum and minimum values of the Close
column for both Apple and Tesla stock data and select all correct answers.
Select the correct average and median values of the Close
column for both Apple and Tesla stocks in this activity.
Create a new column called High_Low_Diff
in both the Apple and Tesla data to calculate the difference between the "High" and "Low" values.
Rename the columns in the Apple and Tesla data to make them more readable as follows:
For the Apple data dataset, the column:
{'Open': 'Apple_Open', 'High': 'Apple_High', 'Low': 'Apple_Low', 'Close': 'Apple_Close', 'Adj Close': 'Apple_Adj_Close', 'Volume': 'Apple_Volume'}
For the Tesla data dataset, the column:
{'Open': 'Tesla_Open', 'High': 'Tesla_High', 'Low': 'Tesla_Low', 'Close': 'Tesla_Close', 'Adj Close': 'Tesla_Adj_Close', 'Volume': 'Tesla_Volume'}
Drop all the rows from apple_df
and tesla_df
that correspond to the month of May 2022.
Add new rows to the Apple and Tesla data for a new day in this activity.
Apple dataset new row details:
{'Date': pd.to_datetime('2023-02-18'), 'Apple_Open': 300.0, 'Apple_High': 305.0, 'Apple_Low': 295.0, 'Apple_Close': 303.0, 'Apple_Adj_Close': 303.0, 'Apple_Volume': 50000000, 'High_Low_Diff': 10.0}
Tesla dataset new row details:
{'Date': pd.to_datetime('2023-02-18'), 'Tesla_Open': 700.0, 'Tesla_High': 710.0, 'Tesla_Low': 690.0, 'Tesla_Close': 702.0, 'Tesla_Adj_Close': 702.0, 'Tesla_Volume': 20000000, 'High_Low_Diff': 20.0}
Select all the correct options.
Write month name for both Apple and Tesla dataset sperated by comma like this: January, April
.
Write month name for both Apple and Tesla dataset sperated by comma like this: January, April
.
Write mean value for both Apple and Tesla dataset sperated by comma like this: 2683.919982, 4016.179992
.
In this activity, we will filter the Apple and Tesla data to select only the rows that meet a specific criteria. We will filter the data to select rows where the closing price is greater than the opening price for both stocks. The results for Apple and Tesla will be stored in apple_pos
and tesla_pos
dataframes, respectively.
Write in this format: (120, 12)
Write in this format: (120, 12)
In this activity, we will filter the data for Apple and Tesla stocks based on multiple criteria. We will filter the data to select rows where the volume is greater than 50 million and the closing price is greater than the opening price for both stocks. The results for Apple and Tesla will be stored in apple_filtered
and tesla_filtered
dataframes, respectively.
In this activity, we will filter the data for Apple and Tesla stocks based on the values in a specific column. We will filter the data for both stocks where the closing price is greater than or equal to 280. The results for Apple and Tesla will be stored in apple_filtered_close
and tesla_filtered_close
dataframes, respectively.
In this activity, we will re-read the apple.csv
and tesla.csv
stock files and filter them for plotting. We will ensure that the dates are parsed correctly. The filtered data will be stored in the apple_pos
and tesla_pos
dataframes. We will filter the data from August 2022 onwards to select rows where the closing price is greater than the opening price for both Apple and Tesla stocks.
Plot the Close price in apple_df
using Date
as its x
axis and Close
as its y
axis. Plot only the prices starting in August 1st, 2022 (inclusive).
"Apple Close Price from August 2022"
"black"
Make sure you're storing the results of .plot
in the variable ax
. It should look something like:
In this activity, we will plot the line chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function.
In this activity, we will plot the line chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Volume
column for the y-axis. Which of the following statements are correct?
In this activity, we will plot the bar chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Volume
column for the y-axis. Which of the following statements are correct?
In this activity, we will plot the bar chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Close
column for the y-axis. Which of the following statements are correct?
In this activity, we will plot the pie chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Close
column for the y-axis. Which of the following statements are correct?
In this activity, we will plot the pie chart for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Volume
column for the y-axis. Which of the following statements are correct?
In this activity, we will plot the scatter plot for the filtered dataframes apple_pos
and tesla_pos
using the plot
function. Use the Date
column for the x-axis and Close
column for the y-axis. Which of the following statements are correct?