소스 검색

Adding missing columns to dataframe before entering it into inconsist table

ogert 5 년 전
부모
커밋
630871895b
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      cdplib/db_migration/MigrationCleaning.py

+ 2 - 3
cdplib/db_migration/MigrationCleaning.py

@@ -235,9 +235,8 @@ class MigrationCleaning:
 
 
             if len(columns) > 0:
             if len(columns) > 0:
                 columns_not_in_data = [column for column in columns if column not in data.columns]
                 columns_not_in_data = [column for column in columns if column not in data.columns]
-                print('THESE ARE ALL COLUMNS THAT WAS MISSING', columns_not_in_data)
-                data_inconsist[columns_not_in_data] = 'Column does not exist in the mongo database and has therefore been dropped'
-                print('THIS ARE THE COLUMNS IN INCONSIST DATA:', data_inconsist.columns)
+                for value in columns_not_in_data:
+                    df[value] = 'Column does not exist in the mongo database and has therefore been dropped'
                 data_inconsist = data_inconsist[columns]
                 data_inconsist = data_inconsist[columns]
 
 
         db.append_to_table(data=data_inconsist,
         db.append_to_table(data=data_inconsist,