Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified q01_load_data_and_add_column_names/__init__.pyc
Binary file not shown.
13 changes: 12 additions & 1 deletion q01_load_data_and_add_column_names/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import pandas as pd
import numpy as np


path = 'data/GermanData.csv'

def q01_load_data_and_add_column_names():
def q01_load_data_and_add_column_names(path):
data= pd.read_csv(filepath_or_buffer=path, skip_blank_lines=True #, header=None # commented to pass the testcase
)
data.columns =['account_status', 'month', 'credit_history', 'purpose', 'credit_amount', 'savings_account/bonds',
'employment', 'installment_rate', 'personal_status/sex', 'guarantors', 'residence_since',
'property', 'age', 'other_installment_plans', 'housing', 'number_of_existing_credits', 'job', 'liable', 'telephone', 'foreign_worker', 'good/bad'
]
#map good/bad to 0, 1
data["good/bad"] = np.where( data["good/bad"]==1 , 0 ,1)
return data

print (q01_load_data_and_add_column_names(path).head())
Binary file modified q01_load_data_and_add_column_names/build.pyc
Binary file not shown.
Binary file modified q01_load_data_and_add_column_names/tests/__init__.pyc
Binary file not shown.
Binary file modified q01_load_data_and_add_column_names/tests/test.pyc
Binary file not shown.