Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help getting this to work: import sys sys.path.append('/Users/...') import warnings warnings.simplefilter(ignore) import pandas as pd data0=pd.read_excel('ks-projects-cleaned1.xlsx') data_rule=data0 # We keep a copy of

Need help getting this to work:

import sys
sys.path.append('/Users/...')

import warnings
warnings.simplefilter("ignore")  

import pandas as pd

data0=pd.read_excel('ks-projects-cleaned1.xlsx')

data_rule=data0 # We keep a copy of the original data for association rule analysis, because we don't need to fill missing values.

data0=data0.fillna(data0.mean()) #Replace missing values of numeric attributes with the mean of the attribute

data0=data0.fillna('Missing') #Replace missing values of categorical attributes with string 'Missing'

data_clu=data0 #keep a copy of the data for clustering because it will be further processed for clustering.

data0.head(9).transpose()

from cat_to_dummy_Functions1 import cat_to_dummy   data0=cat_to_dummy(data0,['state','country']) #Convert categorical values to 0/1. Used for classification & numeric prediction    data0.head().transpose()

Here is the function:

def cat_to_dummy(data,list):    import pandas as pd        for i in list:            data=pd.concat([data, pd.get_dummies(data[i], prefix = i)], axis = 1)    data=data.drop(list, axis = 1)        return data

Here is what I am currently getting:

Here is the data:

  

 

2 4 5 0 1 currency GBP CAD USD USD GBP USD goal 1000 1000 2500 2500 5000 200000 12000 2500 13500 12000 50000 pledged 000 state failed failed failed backers 0 0 0 GB CA US 0 0 country usd pledged 0 3 data0.head().transpose() 0 0 US 0 0 0 137 failed failed failed failed failed failed 0 0 GB 0 0 US 6 0 7 8 USD EUR CAD 0 US 0 0 2 0 IT CA 0 0 : from cat_to_dummy_Functions import cat_to_dummy data=cat_to_dummy (data0, ['currency', 'state', 'country']) #Convert categorical values to 0/1. Used for classification & numeric prediction

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Project Management The Managerial Process

Authors: Eric W Larson, Clifford F. Gray

8th Edition

1260570436, 978-1260570434

More Books

Students also viewed these Programming questions

Question

the folder is empty, can you update it please?

Answered: 1 week ago