Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WHY Senior Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pjm363 (Philip Monaco)
WHY Senior Project
Commits
93601374
Commit
93601374
authored
3 years ago
by
ibe23
Browse files
Options
Downloads
Patches
Plain Diff
75% Finished. Need to tweak classes and add comments.
parent
5059977d
No related branches found
No related tags found
No related merge requests found
Pipeline
#1409
passed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
DataIngestion.py
+66
-0
66 additions, 0 deletions
DataIngestion.py
with
66 additions
and
0 deletions
DataIngestion.py
0 → 100644
+
66
−
0
View file @
93601374
import
pandas
as
pd
import
numpy
as
np
import
os
from
sklearn.model_selection
import
train_test_split
class
Load
:
def
__init__
(
self
,
fileName
):
self
.
fileName
=
fileName
def
loadCVS
(
filename
):
data
=
pd
.
read_csv
(
"
filename.csv
"
)
return
data
def
loadJSON
(
filename
):
data
=
pd
.
read_json
(
'
data.json
'
)
return
data
class
Split
:
def
__init__
(
self
,
fileName
):
self
.
fileName
=
fileName
def
splitIntoTrainandTestData
(
df
):
X
=
df
.
iloc
[:,
:
-
1
]
y
=
df
.
iloc
[:,
-
1
]
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
test_size
=
0.05
,
random_state
=
0
)
return
X_train
,
X_test
,
y_train
,
y_test
def
allowUserToSelectSetsOfData
(
df
):
return
df
class
Validation
:
def
__init__
(
self
,
fileName
):
self
.
fileName
=
fileName
def
checkFileType
(
fileName
):
if
not
(
os
.
path
.
splitext
(
fileName
)[
1
]
==
"
.cvs
"
or
os
.
path
.
splitext
(
fileName
)[
1
]
==
"
.json
"
):
return
False
return
True
def
checkNullValues
(
data
):
for
x
in
range
(
len
(
data
)):
for
y
in
range
(
len
(
data
)):
if
data
[
x
][
y
]
==
"
"
:
return
False
return
True
def
checkFeatureNames
(
df
):
for
col_name
in
df
.
columns
:
print
(
col_name
)
def
checkInfValues
(
df
):
count
=
np
.
isinf
(
df
).
values
.
sum
()
if
count
>
0
:
return
False
return
True
class
DataIngestion
:
def
__init__
(
self
,
load
,
split
,
validation
):
self
.
load
=
load
self
.
split
=
split
self
.
validation
=
validation
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment