Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
preprocess-data
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
preprocess-data
Commits
bd353ed9
Commit
bd353ed9
authored
Feb 23, 2021
by
dasharatha.vamshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkl
parent
f06b4bd0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
main.py
main.py
+11
-4
scripts/common/__pycache__/config_parser.cpython-37.pyc
scripts/common/__pycache__/config_parser.cpython-37.pyc
+0
-0
scripts/common/config_parser.py
scripts/common/config_parser.py
+1
-0
No files found.
main.py
View file @
bd353ed9
...
@@ -41,10 +41,11 @@ class PreProcessComponent:
...
@@ -41,10 +41,11 @@ class PreProcessComponent:
sc_X
=
self
.
read_pickle_file
(
standard_scalar_pkl_path
)
sc_X
=
self
.
read_pickle_file
(
standard_scalar_pkl_path
)
X
=
sc_X
.
transform
(
forcast_data
)
X
=
sc_X
.
transform
(
forcast_data
)
return
X
return
X
,
self
.
date
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
logger
.
info
(
config
)
# Checking shared Volume
# Checking shared Volume
if
PreProcessConstants
.
SHARED_VOLUME
in
config
.
keys
():
if
PreProcessConstants
.
SHARED_VOLUME
in
config
.
keys
():
shared_volume
=
config
[
PreProcessConstants
.
SHARED_VOLUME
]
shared_volume
=
config
[
PreProcessConstants
.
SHARED_VOLUME
]
...
@@ -60,6 +61,10 @@ if __name__ == '__main__':
...
@@ -60,6 +61,10 @@ if __name__ == '__main__':
# Checking pickle path for standard scalar
# Checking pickle path for standard scalar
if
PreProcessConstants
.
STANDARD_SCALAR_PATH
in
config
.
keys
():
if
PreProcessConstants
.
STANDARD_SCALAR_PATH
in
config
.
keys
():
standard_scalar_path
=
config
[
PreProcessConstants
.
STANDARD_SCALAR_PATH
]
standard_scalar_path
=
config
[
PreProcessConstants
.
STANDARD_SCALAR_PATH
]
if
standard_scalar_path
is
None
:
standard_scalar_path
=
"StandardScaler.pkl"
else
:
pass
else
:
else
:
raise
Exception
(
ComponentExceptions
.
INVALID_JSON_PATH
)
raise
Exception
(
ComponentExceptions
.
INVALID_JSON_PATH
)
...
@@ -68,14 +73,16 @@ if __name__ == '__main__':
...
@@ -68,14 +73,16 @@ if __name__ == '__main__':
fillna_method
=
config
[
PreProcessConstants
.
FILLNA_METHOD
]
fillna_method
=
config
[
PreProcessConstants
.
FILLNA_METHOD
]
else
:
else
:
raise
Exception
(
ComponentExceptions
.
INVALID_Fillna_Method
)
raise
Exception
(
ComponentExceptions
.
INVALID_Fillna_Method
)
obj
=
PreProcessComponent
()
obj
=
PreProcessComponent
()
data
=
obj
.
preprocess
(
json_path
,
standard_scalar_path
,
fillna_method
)
data
,
date_pkl
=
obj
.
preprocess
(
json_path
,
standard_scalar_path
,
fillna_method
)
logger
.
info
(
"Got the data writing it to pickle file
(preprocessed
_X.pkl)"
)
logger
.
info
(
"Got the data writing it to pickle file
s (preprocessed_X.pkl and date
_X.pkl)"
)
try
:
try
:
output
=
open
(
os
.
path
.
join
(
shared_volume
,
'preprocessed_X.pkl'
),
'wb'
)
output
=
open
(
os
.
path
.
join
(
shared_volume
,
'preprocessed_X.pkl'
),
'wb'
)
pickle
.
dump
(
data
,
output
)
pickle
.
dump
(
data
,
output
)
output
.
close
()
output
.
close
()
output1
=
open
(
os
.
path
.
join
(
shared_volume
,
'date_X.pkl'
),
'wb'
)
pickle
.
dump
(
date_pkl
,
output1
)
output1
.
close
()
logger
.
info
(
"Component executed Successfully"
)
logger
.
info
(
"Component executed Successfully"
)
except
Exception
as
e
:
except
Exception
as
e
:
raise
Exception
(
e
)
raise
Exception
(
e
)
scripts/common/__pycache__/config_parser.cpython-37.pyc
View file @
bd353ed9
No preview for this file type
scripts/common/config_parser.py
View file @
bd353ed9
...
@@ -30,6 +30,7 @@ LOGSTASH_PORT = str(_config.get('SERVICE_CONFIG', {}).get('LOGSTASH_PORT'))
...
@@ -30,6 +30,7 @@ LOGSTASH_PORT = str(_config.get('SERVICE_CONFIG', {}).get('LOGSTASH_PORT'))
# os.environ["json_path"] = r"E:\welspun-defects\preprocess_data-ilendev\response.json"
# os.environ["json_path"] = r"E:\welspun-defects\preprocess_data-ilendev\response.json"
# os.environ["fillna_method"] = "ffill"
# os.environ["fillna_method"] = "ffill"
# os.environ["standard_scalar_path"] = r"E:\welspun-defects\preprocess_data-ilendev\StandardScaler.pkl"
# os.environ["standard_scalar_path"] = r"E:\welspun-defects\preprocess_data-ilendev\StandardScaler.pkl"
print
(
os
.
getcwd
())
PKL_path
=
os
.
path
.
join
(
os
.
getcwd
(),
'StandardScaler.pkl'
)
PKL_path
=
os
.
path
.
join
(
os
.
getcwd
(),
'StandardScaler.pkl'
)
config
=
{
config
=
{
"shared_volume"
:
os
.
environ
.
get
(
"shared_volume"
),
"shared_volume"
:
os
.
environ
.
get
(
"shared_volume"
),
...
...
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