<jupyter_start><jupyter_text><jupyter_code>#importing libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#reading the file and converting it to dataframe
data = pd.read_excel(r'E:\DIVYANSH\B.Tech\AC_Data.xlsx', parse_dates=[0], index_col=0)
#viewing data
data.head()
#inspecting data
data.shape
#checking for null values
data.isna().sum()
#filling the null values with 0
data=data.fillna(0)
#chanching the index name (for convenience)
data.index.names=["Date"]
#checking the null values again
data.isna().sum()
#checking data properties
data.describe()
#checking datatype of column
data.dtypes
#checking index
data.index<jupyter_output><empty_output><jupyter_text>1. Identify patterns/trends in the data?<jupyter_code>#creating line graph for mean power consumption by each AC
plt.xlabel("ACs")
plt.ylabel("Mean power consumption")
data.mean().plot(figsize=(18,4))<jupyter_output><empty_output><jupyter_text>This shows the mean power consumption by each AC.<jupyter_code>#creating a new dataframe for august power consumption
df_aug=data.loc["2019-08"]
#checking shape of the dataframe for august
df_aug.shape
#getting the sum of power consumption by each AC in August
plt.xlabel("ACs")
plt.ylabel("August total power consumption")
df_power_aug=df_aug.sum()
df_power_aug.plot.bar(figsize=(18, 4))<jupyter_output><empty_output><jupyter_text>This diagram shows the per AC power consumption in AUGUST.<jupyter_code>#creating a new dataframe for september power consumption
df_sep=data.loc["2019-09"]
#checking shape of the dataframe for September
df_sep.shape
#getting the sum of power consumption by each AC in September
plt.xlabel("ACs")
plt.ylabel("September total power consumption")
df_power_sept=df_sep.sum()
df_power_sept.plot.bar(figsize=(18, 4))<jupyter_output><empty_output><jupyter_text>This diagram shows the per AC power consumption in SEPTEMBER.<jupyter_code>#Creating new column of "Total power consumption"
data["total power consumption sum"] = data.sum(axis=1)
#viewing data
data.head()
#ploting "total power consumption" with time
data.plot(y='total power consumption sum',use_index=True, kind='line', figsize=(18,6))<jupyter_output><empty_output><jupyter_text>Here we can observe the two months trend of the power consumption.<jupyter_code>#droping the newly created "total power consumption" column
data_Q2=data.drop(['total power consumption sum'], axis = 1)<jupyter_output><empty_output><jupyter_text>2. Which AC was used the most/least?<jupyter_code>#finding the sum of power usage by ACs
power_usage = data_Q2.sum()
most_power_usage = power_usage.nlargest(1)
least_power_usage = power_usage.nsmallest(1)<jupyter_output><empty_output><jupyter_text>Most and Least power consumption in both month August and September<jupyter_code>#fetching AC with most power usage (aug+sept)
most_power_usage
#fetching AC with least power usage(aug+sept)
least_power_usage<jupyter_output><empty_output><jupyter_text>Most and Least power consumption in month August<jupyter_code>#fetching AC with most power usage(aug)
df_power_aug.nlargest(1)
#fetching AC with least power usage(aug)
df_power_aug.nsmallest(1)
#fetching AC with most power usage(sept)
df_power_sept.nlargest(1)
#fetching AC with least power usage(sept)
df_power_sept.nsmallest(1)<jupyter_output><empty_output><jupyter_text>Ans 2. Hence, AC18 has used most power and AC5 has used least power in combined month August and September.In month of August most power was consumed by AC18 (144831.86) and least power was consumed by AC 5 (29964.796).And, in month of September most power was consumed by AC18 (137735.703) and least power was consumed by AC 10 (31402.63).  3. Relate this power data with the outside temperature of Gurgaon. I downloaded the weather data of Gurgaon from Aug 1,2019 to sep 30, 2019 from a website:https://www.visualcrossing.com/weather/weather-data-servicesThen I tried to correlate the daily power consumtion data of the hotel with outside temperature data of Gurgaon.<jupyter_code>#Uploading a new dataset of weather data
df=pd.read_excel(r"E:\DIVYANSH\B.Tech\Comparison_of_AC_power_usage_with_outside_temperature.xlsx")
#vewing data
df.head()
#checking the two columns for correlation
column_1 = df["Power Consumption"]
column_2 = df["Outside temperature"]
correlation = column_1.corr(column_2)
#finding correlation
correlation<jupyter_output><empty_output><jupyter_text>The correlation between two columns ie. power consumed and outside temperature is not strong. Hence we can say that AC power consumptionis not strongly connected to outside temerature.<jupyter_code>#creating the scatter plot between "Outside temperature" and "Power consumption"
df.plot.scatter(x='Power Consumption', y='Outside temperature',figsize=(18, 5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09092809364548494, 'fraction_numerical': 0.021321070234113712, 'mean_word_length': 7.2075471698113205, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '636111', 'license': 'Apache-2.0', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1512, 'n_words': 483, 'path': 'Task_Solution_Zenatix_Solutions_.ipynb', 'repo_name': 'Uks-py/Amazon_App_DataAnalysis', 'size': '4784'}