Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kl_task5
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
arun.uday
kl_task5
Commits
6d87d9e1
Commit
6d87d9e1
authored
Jan 30, 2023
by
arun.uday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all
parent
70f50136
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
75 additions
and
40 deletions
+75
-40
.idea/misc.xml
+2
-1
.idea/modules.xml
+2
-1
.idea/sonarlint/issuestore/index.pb
+4
-0
.idea/task5pandas_op.iml
+2
-1
scripts/core/handlers/change_time_data.py
+4
-4
scripts/core/handlers/melted_data_frames.py
+4
-3
scripts/core/handlers/merge_data_frames.py
+3
-2
scripts/core/handlers/pivoted_data_frames.py
+3
-5
scripts/json_output/data_melt_json.json
+0
-0
scripts/json_output/data_merge_json.json
+11
-5
scripts/json_output/data_pivot_json.json
+17
-7
scripts/json_output/data_time_json.json
+20
-8
scripts/services/access_operations.py
+3
-3
No files found.
.idea/misc.xml
View file @
6d87d9e1
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9 (task5)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9 (task5
- Copy
)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
.idea/modules.xml
View file @
6d87d9e1
...
...
@@ -2,7 +2,7 @@
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/task5
.iml"
filepath=
"$PROJECT_DIR$/.idea/task5
.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/task5
pandas_op.iml"
filepath=
"$PROJECT_DIR$/.idea/task5pandas_op
.iml"
/>
</modules>
</component>
</project>
\ No newline at end of file
.idea/sonarlint/issuestore/index.pb
View file @
6d87d9e1
No preview for this file type
.idea/task5.iml
→
.idea/task5
pandas_op
.iml
View file @
6d87d9e1
...
...
@@ -4,7 +4,7 @@
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
<orderEntry
type=
"
inheritedJdk
"
/>
<orderEntry
type=
"
jdk"
jdkName=
"Python 3.9 (task5 - Copy)"
jdkType=
"Python SDK
"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
scripts/core/handlers/change_time_data.py
View file @
6d87d9e1
...
...
@@ -9,11 +9,11 @@ def time_change(file):
file_copy
[
'Timestamp'
]
=
file_copy
[
'Timestamp'
]
.
dt
.
strftime
(
date_format
)
# for storing the pivoted frame to dictionary
dict_cols
=
{}
dict_cols
=
[]
for
i
in
range
(
0
,
len
(
file_copy
.
columns
)):
key_dict
=
"label"
+
str
(
i
)
val_dict
=
file_copy
.
columns
[
i
]
dict_cols
.
update
({
key_dict
:
val_dict
})
key_dict
=
file_copy
.
columns
[
i
]
val_dict
=
file_copy
.
columns
[
i
]
.
lower
()
dict_cols
.
append
({
key_dict
:
val_dict
})
# storing the header and body to json
head_cols
=
{
"header"
:
dict_cols
}
...
...
scripts/core/handlers/melted_data_frames.py
View file @
6d87d9e1
...
...
@@ -5,14 +5,15 @@ def melt_frame(file):
file_copy
=
file
# creating the melted dataframe melted_file
melted_file
=
file_copy
.
melt
(
id_vars
=
[
'Timestamp'
],
value_vars
=
[
'kWh'
])
melted_file
=
file_copy
.
melt
(
id_vars
=
[
'Timestamp'
])
print
(
melted_file
)
# for storing the melted frame to dictionary
dict_cols
=
{}
dict_cols
=
[]
for
i
in
range
(
0
,
len
(
melted_file
.
columns
)):
key_dict
=
"label"
+
str
(
i
)
val_dict
=
melted_file
.
columns
[
i
]
dict_cols
.
update
({
key_dict
:
val_dict
})
dict_cols
.
append
({
key_dict
:
val_dict
})
# storing the header and body to json
head_cols
=
{
"header"
:
dict_cols
}
...
...
scripts/core/handlers/merge_data_frames.py
View file @
6d87d9e1
...
...
@@ -11,13 +11,14 @@ def merge_frame(file):
# creating the merged dataframe merged_file
merged_file
=
pd
.
merge
(
file_frame1
,
file_frame2
,
on
=
'Timestamp'
)
print
(
merged_file
)
# for storing the merged frame to dictionary
dict_cols
=
{}
dict_cols
=
[]
for
i
in
range
(
0
,
len
(
merged_file
.
columns
)):
key_dict
=
"label"
+
str
(
i
)
val_dict
=
merged_file
.
columns
[
i
]
dict_cols
.
update
({
key_dict
:
val_dict
})
dict_cols
.
append
({
key_dict
:
val_dict
})
# storing the header and body to json
head_cols
=
{
"header"
:
dict_cols
}
...
...
scripts/core/handlers/pivoted_data_frames.py
View file @
6d87d9e1
...
...
@@ -3,18 +3,16 @@
def
pivot_frame
(
file
):
file_copy
=
file
# pivoting the data
pivoted_d
=
file_copy
.
pivot_table
(
index
=
'Timestamp'
,
columns
=
[],
values
=
file_copy
)
print
(
pivoted_d
)
# for storing the pivoted frame to dictionary
dict_cols
=
{}
dict_cols
=
[]
for
i
in
range
(
0
,
len
(
pivoted_d
.
columns
)):
key_dict
=
"label"
+
str
(
i
)
val_dict
=
pivoted_d
.
columns
[
i
]
dict_cols
.
update
({
key_dict
:
val_dict
})
dict_cols
.
append
({
key_dict
:
val_dict
})
# storing the header and body to json
head_cols
=
{
"header"
:
dict_cols
}
body_vals
=
{
"body"
:
pivoted_d
.
to_dict
(
orient
=
"records"
)}
...
...
scripts/json_output/data_melt_json.json
View file @
6d87d9e1
This diff is collapsed.
Click to expand it.
scripts/json_output/data_merge_json.json
View file @
6d87d9e1
{
"header"
:
{
"label0"
:
"Timestamp"
,
"label1"
:
"kW"
,
"label2"
:
"kVA"
},
"header"
:
[
{
"label0"
:
"Timestamp"
},
{
"label1"
:
"kW"
},
{
"label2"
:
"kVA"
}
],
"body"
:
[
{
"Timestamp"
:
"01-12-19 00-00-21"
,
...
...
scripts/json_output/data_pivot_json.json
View file @
6d87d9e1
{
"header"
:
{
"label0"
:
"current"
,
"label1"
:
"kVA"
,
"label2"
:
"kVAh"
,
"label3"
:
"kW"
,
"label4"
:
"kWh"
},
"header"
:
[
{
"label0"
:
"current"
},
{
"label1"
:
"kVA"
},
{
"label2"
:
"kVAh"
},
{
"label3"
:
"kW"
},
{
"label4"
:
"kWh"
}
],
"body"
:
[
{
"current"
:
281.58292388916016
,
...
...
scripts/json_output/data_time_json.json
View file @
6d87d9e1
{
"header"
:
{
"label0"
:
"Timestamp"
,
"label1"
:
"kWh"
,
"label2"
:
"kVAh"
,
"label3"
:
"kW"
,
"label4"
:
"kVA"
,
"label5"
:
"current"
},
"header"
:
[
{
"Timestamp"
:
"timestamp"
},
{
"kWh"
:
"kwh"
},
{
"kVAh"
:
"kvah"
},
{
"kW"
:
"kw"
},
{
"kVA"
:
"kva"
},
{
"current"
:
"current"
}
],
"body"
:
[
{
"Timestamp"
:
"01-12-19 00-00-21"
,
...
...
scripts/services/access_operations.py
View file @
6d87d9e1
...
...
@@ -18,14 +18,14 @@ def access_op():
print
(
"Pivoting the dataframe"
)
dict_data_pivoted
,
pivot_change
=
json_pandas
.
pivot_data
(
file_concat
)
json_pandas
.
create_json
(
path_pivot
,
pivot_change
)
json_pandas
.
create_json
(
path_pivot
,
dict_data_pivoted
)
print
(
"Melting the dataframe"
)
melt_change
=
json_pandas
.
melt_data
(
dict_data_pivoted
)
melt_change
=
json_pandas
.
melt_data
(
file_concat
)
json_pandas
.
create_json
(
path_melt
,
melt_change
)
print
(
"Merging the dataframe"
)
merge_change
=
json_pandas
.
merge_data
(
dict_data_pivoted
)
merge_change
=
json_pandas
.
merge_data
(
file_concat
)
json_pandas
.
create_json
(
path_merge
,
merge_change
)
except
Exception
as
e
:
...
...
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