Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
email_task
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
logesh.n
email_task
Commits
48572f1c
Commit
48572f1c
authored
Jan 25, 2023
by
logesh.n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed
parent
0723f1a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
24 deletions
+25
-24
app.py
+11
-10
readxl.py
+14
-14
No files found.
app.py
View file @
48572f1c
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
],
message
1
)
readxl.py
View file @
48572f1c
# 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
(
"
\n
The 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
(
"
\n
The 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment