Commit 48572f1c by logesh.n

completed

parent 0723f1a9
import smtplib
import ssl
from readxl import df1
# importing from readxl
from readxl import avg, maximum, minimum, final_time
port = 465 # For SSL
smtp_server = "smtp.gmail.com"
sender_email = "logesh.n@knowledgelens.com" # Enter your address
receiver_email = ["rakeshpvofficial@gmail.com", "rakeshpvuokl@gmail.com"] # Enter receiver address
print("heloo")
print(df1)
print(type(df1))
df2 = str(df1)
print("df2", df2)
print(type(df2))
receiver_email = ["rakeshpvofficial@gmail.com", "rakeshpvuokl@gmail.com", "logeshnandhakumar12@gmail.com"]
# Enter receiver address
password = input("Type your password and press enter: ")
message = df2
message1 = avg + maximum + minimum
message2 = final_time
message3 = str(final_time)
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
server.login(sender_email, password)
for i in range(len(receiver_email)):
server.sendmail(sender_email, receiver_email[i], message)
server.sendmail(sender_email, receiver_email[i], message1)
# importing pandas to read the xlsx file
# df1 stores avg of all columns except timestamp, df2 stores max of all columns
# df1 stores avg of all columns except timestamp, df2 stores max of all columns, df3 stores min of all columns
# Pandas dataframe.idxmax() method returns the index of the first occurrence of maximum over the requested axis.
import pandas as pd
......@@ -8,23 +8,24 @@ df = pd.read_excel('D:/sources/task3.xlsx')
# rounding of the columns to two decimal points and getting the average of each of the columns
df1 = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].mean(), 2)
print("The average of kWh, kVAh, kW, kVA, current as respectively >>\n\n", df1)
avg = str(df1)
# rounding of the columns to two decimal points and getting the max of each of the columns
df2 = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].max(), 2)
print("\nThe Maximum of kWh, kVAh, kW, kVA, current as respectively >>\n\n", df2)
maximum = str(df2)
# rounding of the columns to two decimal points and getting the min of each of the columns
df3 = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].min(), 2)
print("\nThe Minimum of kWh, kVAh, kW, kVA, current as respectively >>\n\n", df3)
minimum = str(df3)
dff = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].idxmax(), 0)
dfff = df["current"].idxmax()
print(dff)
# col = "current"
# max_x = df.loc[df[col].idxmax()]
# print("DS")
# print(max_x)
# finding the timestamp of max value of each column
df_time = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].idxmax(), 0)
max_time = df["Timestamp"][df_time]
timestamps_max = str(max_time)
new = df["Timestamp"][dff]
print(new)
\ No newline at end of file
# finding the timestamp of max value of each column
df_time = round(df[["kWh", "kVAh", "kW", "kVA", "current"]].idxmin(), 0)
min_time = df["Timestamp"][df_time]
timestamps_min = str(min_time)
final_time = timestamps_max + timestamps_min
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment