I want to add Panda Operations, Lambda Functions, and IF statements in the code. So yeah please tell me where I should add these python syntax in this given code:
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import pandas as pd
import statsmodels.api as sm
sns.set_style("darkgrid")
mpl.rcParams['figure.figsize'] = (20,5)
#import dataset
df = pd.read_csv("electricity_prices.csv")
# transform each ? into `nan`
df = pd.read_csv("electricity_prices.csv", na_values=['?'])
# Return DataFrame with labels on given axis omitted null values.
df = df.dropna()
df.info()
# to find number of rows and columns
df.shape
small_df = df.drop(columns=['DayOfWeek','Holiday','HolidayFlag','WeekOfYear','Day','Month','Year'])
# Box and line plots with all the variables.
small_df.plot(kind='box',title='Box Plot')
plt.show()
small_df.plot(kind='line',title='Line Plot')
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.show()
# Plot and examine each column. This step is done to assess different variables with respect their respective scales.
# This helps to asses which variables are more significant with respect to SMPEP2/electricity price.
#These are all the variables we wish to loop through.
List_Of_Variables = ['PeriodOfDay','ForecastWindProduction', 'SystemLoadEA', 'SMPEA','ORKTemperature',
'ORKWindspeed', 'CO2Intensity','ActualWindProduction','SystemLoadEP2']
y = small_df['SMPEP2']
small_df.set_index('DateTime', inplace=True)
for i in List_Of_Variables:
first_axis = small_df[i].plot()
first_axis.xaxis.set_major_locator(plt.MaxNLocator(10))
second_axis = first_axis.twinx()
second_axis.plot(small_df['SMPEP2'], color='red')
second_axis.xaxis.set_major_locator(plt.MaxNLocator(10))
plt.title(i)
plt.show()
done please do it. It is python 3 code and data frame gotten from https://www.kaggle.com/afu123best/price-prediction-neural-network-and-xgboost/edit which is the source code from where I took the data frame from Kaggle and it is a website so please help me its a project and it requires that so.
Aucun commentaire:
Enregistrer un commentaire