1010def read_raw_data (filename ,column_file ,samplename ,dataset_name ):
1111 filename = "../00_raw_data/" + filename
1212 path_to_file = relative_to_absolute (filename )
13- columns = read_raw_columns (column_file )
13+ columns , dtypes = read_raw_columns (column_file )
1414 df = pd .read_csv (path_to_file , names = columns ,low_memory = False , encoding = "ansi" )
15+ ### deactivated
16+ # due to unwanted data altering
17+ # see for example column DoYouPurchaseForOthers before and after execution
18+ #df = recreate_dtypes(df, dtypes)
19+ ### end of deactivation
20+ #create_sampel_excel(df,samplename)
1521 save_dataframe (df ,dataset_name )
16- # print(df)
22+ print (df )
1723 return df
1824
1925def read_raw_columns (filename ):
@@ -28,7 +34,7 @@ def read_raw_columns(filename):
2834 string_list = string .split (":" )
2935 column_list .append (string_list [0 ])
3036 dtype_list .append (identify_column_type (string_list [1 ]))
31- return column_list
37+ return column_list , dtype_list
3238
3339def load_dataframe_without_ignore (filename , column_file ):
3440 #Determine which columns should be ignored
@@ -93,7 +99,7 @@ def split_ordered_categories(categories):
9399
94100def create_sampel_excel (dataframe ,samplename ):
95101 from pandas import ExcelWriter
96- #create a Excelsheet with the heads and the first 1000 lines for data unterstanding
102+ #create a Excelsheet with the heads and the first 100 lines for data unterstanding
97103 df = dataframe .iloc [:1000 ]
98104 samplename = "../01_data_understanding/" + samplename
99105 path_to_file = relative_to_absolute (samplename )
@@ -120,6 +126,6 @@ def load_dataframe(filename):
120126
121127
122128
123- #test if dataset is altered by type change
129+ ## test if dataset is altered by type change
124130#df = read_raw_data("order_data.csv","order_columns.txt","order.xlsx","order.pkl")
125131#print(df[["DoYouPurchaseForOthers","SendEmail","ProductCode","New Bank Card"]])
0 commit comments