Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
8f4d70c1
Commit
8f4d70c1
authored
Apr 04, 2015
by
panos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixed in the ReplaceMissingValues object
parent
73b3fa33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
dream/KnowledgeExtraction/ReplaceMissingValues.py
dream/KnowledgeExtraction/ReplaceMissingValues.py
+4
-3
No files found.
dream/KnowledgeExtraction/ReplaceMissingValues.py
View file @
8f4d70c1
...
...
@@ -46,7 +46,8 @@ class HandleMissingValues(BasicStatisticalMeasures):
def
ReplaceWithMean
(
self
,
mylist
):
#Replace in the given list the missing values with the mean value
list1
=
self
.
DeleteMissingValue
(
mylist
)
#Create a new list, which is the given list deleting the missing values (calling the DeleteMissingValue method)
mean
=
sum
(
list1
)
/
float
(
len
(
list1
))
#Calculate the mean value of the new list
# mean=sum(list1)/float(len(list1)) #Calculate the mean value of the new list
mean
=
self
.
mean
(
list1
)
i
=
0
for
value
in
mylist
:
if
value
is
''
:
...
...
@@ -56,8 +57,8 @@ class HandleMissingValues(BasicStatisticalMeasures):
def
ReplaceWithMedian
(
self
,
mylist
):
#Replace in the given list the missing values with the median value
list1
=
self
.
DeleteMissingValue
(
mylist
)
#Create a new list, which is the given list deleting the missing values (calling the DeleteMissingValue method)
A
=
BasicStatisticalMeasures
()
#Call the BasicStatisticalMeasures to calculate the median value
median
=
A
.
median
(
list1
)
#Calculate the median value of the new list
#
A=BasicStatisticalMeasures() #Call the BasicStatisticalMeasures to calculate the median value
median
=
self
.
median
(
list1
)
#Calculate the median value of the new list
i
=
0
for
value
in
mylist
:
if
value
is
''
:
...
...
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