Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RSE 23 Group Assignment Shervud Pitawanik Franz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Niklas Franz
RSE 23 Group Assignment Shervud Pitawanik Franz
Commits
7a3ca6f5
Commit
7a3ca6f5
authored
1 year ago
by
Sortofamudkip
Browse files
Options
Downloads
Patches
Plain Diff
param checking in treat_outliers
parent
267a608f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Dataset.py
+20
-1
20 additions, 1 deletion
src/Dataset.py
with
20 additions
and
1 deletion
src/Dataset.py
+
20
−
1
View file @
7a3ca6f5
...
...
@@ -160,7 +160,26 @@ class Dataset:
is_competitive_col
=
self
.
get_is_competitive_col
(
dataframe
)
return
is_competitive_col
def
treat_outliers
(
self
,
df
,
colname
)
->
pd
.
DataFrame
:
def
treat_outliers
(
self
,
df
:
pd
.
DataFrame
,
colname
:
str
)
->
pd
.
DataFrame
:
"""
Treat outliers of numerical columns.
Args:
df (pd.DataFrame): the dataframe.
colname (str): the column name to treat.
Returns:
pd.DataFrame: the filtered dataframe.
"""
if
type
(
df
)
!=
pd
.
DataFrame
:
logging
.
error
(
"
parameter `dataframe` is not a pandas DataFrame
"
)
raise
ValueError
(
f
"
{
df
}
is not a pandas DataFrame
"
)
if
type
(
colname
)
!=
str
:
logging
.
error
(
"
parameter `colname` is not a string
"
)
raise
ValueError
(
f
"
{
colname
}
is not a string
"
)
if
colname
not
in
df
.
columns
:
logging
.
error
(
"
column requested not in dataframe
"
)
raise
KeyError
(
f
"
{
colname
}
is not a column in dataframe
"
)
q
=
df
[
colname
].
quantile
(
0.99
)
return
df
[
df
[
colname
]
<
q
]
...
...
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