As the new version of pandas, pandas 2.0, removed the df.append method, how to modify the following code to add a dictionary to a pandas dataframe.
The old version of code is:
record_score = {}
record_score["model_name"] = model_name
record_score["time"] = crt_time
record_score["epoch"] = best_epoch
record_score["best_score"] = best_score
# save best to file
record_path = "./record.csv"
if not os.path.exists(record_path):
record_table = pd.DataFrame()
else:
record_table = pd.read_csv(record_path)
record_table = record_table.append(record_score, ignore_index=True)
record_table.to_csv(record_path, index=False)
I think now i can just create a new dataframe from the record_score and use pandas.concat to concat the data.
I hope someone can give me some advice to modify the code with an efficient way. Thanks a lot.