Add High Level Line Line Comments Whats Taking Place Program Line Line Comment Every Line Q37264576

Add high level LINE BY LINE comments of whats takingplace in the program.

LINE BY LINE.

A comment for every line even the ones that already haveone please.

from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta

import matplotlib.pyplot as plt
import pandas as pd

#Converting CSV file to DataFrames by reading them
jobs_df = pd.read_csv(‘Jobs.csv’, sep=’t’)
presidents_df = pd.read_csv(‘Presidents.csv’, sep=’t’)

#Transforming date string to date object in each of thedataframes
jobs_df[‘Month’] = pd.to_datetime(jobs_df[‘Month’])

presidents_df[‘Took_office’] =pd.to_datetime(presidents_df[‘Took_office’])
presidents_df[‘Left_office’] =pd.to_datetime(presidents_df[‘Left_office’])

presidents = presidents_df.sort_values(‘Took_office’)

jobs_df.head()

presidents.head()

#Calculating the number of jobs in their first 2 years
def calculate_jobs(president):
  
took_office = president.Took_office
left_office = president.Left_office
  
effective_date_start = took_office + relativedelta(months =1)
effective_date_start = effective_date_start.replace(day = 1)
  
#If the term is less then 2 years
effective_end_date = effective_date_start +

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.