i defined a function,say
def func1(id):
....
logic
dataframe2.to_sql(query)
....
which runs some operations and store the result in database
and i have a table in pandas dataframe which has id column in it,and about 1000 rows with distinct id's
i will be calling this function using .apply function.
df['id'].apply(func1)
which will take one id at a time and do operations and store it in database , and same will happen for all id in my dataframe.
Is there any way to calculate how much total time my function took to run for all id's in df?
i was thinking maybe use time
package and do smthing with it. but i am a beginner.
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))
is there any way to do this?