I have a Pandas dataframe very simple it's shape is (140, 10) but when I use:
df.apply(lambda row: somefunction(row, otherparameter), axis=1)
It's doubling the first row on the dataframe, to prove this I used a print inside of somefunction that prints the row.
the only strange thing that I am doing inside somefunction is inserting a record to a database (but the print is before this instruction so it has nothing to do with it or I believe so). there is some reason why I don't want to use to_sql
function but is another option.
when I check the dataframe shape after the apply line, the shape continues to be the same.
I would like to know possible causes of this