import pandas as pd import tensorflow as tf df = pd.read_csv('data_test.csv') df.drop(['zwyciezca'], axis=1, inplace=True) model = tf.keras.models.load_model('model_election.h5') predictions = model.predict(df).flatten() output = pd.DataFrame({'predicted': predictions}) output.loc[output['predicted'] <= 0.5, 'predicted'] = 0 output.loc[output['predicted'] > 0.5, 'predicted'] = 1 output.to_csv('election_predictions.csv', index=False)