Skip to content

Pre process#1

Open
Balapradeepck wants to merge 1 commit intoHarishac:masterfrom
Balapradeepck:patch-1
Open

Pre process#1
Balapradeepck wants to merge 1 commit intoHarishac:masterfrom
Balapradeepck:patch-1

Conversation

@Balapradeepck
Copy link
Contributor

  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

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
import pandas as pd
import numpy as np

df_raw=pd.read_csv('Source/test1.csv')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot take a Hardcoded location.
It has to be pd.read_csv(location)


df_raw=pd.read_csv('Source/test1.csv')
df1=df_raw.replace('[^0-9]','',regex=True).astype(float)
df2=df1.fillna(df1.mean())
Copy link
Owner

@Harishac Harishac Nov 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Harishac pushed a commit that referenced this pull request Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants