Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastAPI-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
mohammed.shibili
fastAPI-task
Commits
ec7edf89
Commit
ec7edf89
authored
Jan 30, 2023
by
mohammed.shibili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file uploading section added
parent
18007f3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
script/core/handlers/reading_csv.py
+1
-1
script/service/main.py
+6
-1
No files found.
script/core/handlers/reading_csv.py
View file @
ec7edf89
...
...
@@ -3,9 +3,9 @@ import tkinter as tk
from
tkinter
import
filedialog
# reading csv
def
csv_read
():
# section for file upload
try
:
root
=
tk
.
Tk
()
root
.
withdraw
()
...
...
script/service/main.py
View file @
ec7edf89
...
...
@@ -27,17 +27,22 @@ async def get_element():
async
def
get_minmax
():
datas
=
collection_name
.
find
({})
dataframe
=
pd
.
DataFrame
(
list
(
datas
))
# fetching min salary
min_salary
=
dataframe
[
"salary"
]
.
min
()
min_details
=
collection_name
.
find
({
"salary"
:
min_salary
},
{
"_id"
:
0
})
# fetching max salary
max_salary
=
dataframe
[
"salary"
]
.
max
()
max_details
=
collection_name
.
find
({
"salary"
:
max_salary
},
{
"_id"
:
0
})
# fetching average salary
avg_salary
=
dataframe
[
"salary"
]
.
mean
()
details
=
{
"min"
:
max_details
,
"max"
:
min_details
,
"avg"
:
avg_salary
}
# converting details to json
json_string
=
pd
.
io
.
json
.
dumps
(
details
,
orient
=
"records"
,
indent
=
4
)
with
open
(
'temp/details.json'
,
'w'
)
as
file
:
file
.
write
(
json_string
)
df
=
pd
.
read_json
(
"temp/details.json"
)
df
.
to_csv
(
"temp/details.csv"
,
index
=
False
)
# converting details to csv
df
.
to_csv
(
"temp/details.csv"
,
index
=
False
)
return
"data fetched"
...
...
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