Open
Conversation
Contributor
Balapradeepck
commented
Oct 29, 2018
- Import file from specific location
- Remove any alphabet characters or special characters except numbers (0 – 9) at any place in any column.
- Converts values to float.
- Replace any missing values to average of that column
1. Import file from specific location 2. Remove any alphabet characters or special characters except numbers (0 – 9) at any place in any column. 3. Converts values to float. 4. Replace any missing values to average of that column
Harishac
reviewed
Nov 3, 2018
| import pandas as pd | ||
| import numpy as np | ||
|
|
||
| df_raw=pd.read_csv('Source/test1.csv') |
Owner
There was a problem hiding this comment.
Cannot take a Hardcoded location.
It has to be pd.read_csv(location)
Harishac
reviewed
Nov 3, 2018
|
|
||
| df_raw=pd.read_csv('Source/test1.csv') | ||
| df1=df_raw.replace('[^0-9]','',regex=True).astype(float) | ||
| df2=df1.fillna(df1.mean()) |
Owner
There was a problem hiding this comment.
pre process function takes two arguments(location , method)
Use "method" to determine the type of cleaning.
ex:
If method == "Drop":
Do dropna()
elif method == "Prev":
Use replace null by previous value.
elif method == "avg":
add avg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.