I am trying to read CSV files in a thread in pandas. It looks like I am able to run but I don't get the dataframe to append. How do I get the result back so I can append it to another df?
Here is the code I used.
import threading
import pandas as pd
def read_file(filename):
df = pd.read_csv(filename)
return df
myfile = 'accelerometer.csv'
threads = []
t1= threading.Thread(target=read_file,args=[myfile])
t2= threading.Thread(target=read_file,args=[myfile])
t1.start()
t2.start()
t1.join()
t2.join()
I checked the value of t1
it gives me <Thread(Thread-1, stopped 27200)>
instead of dataframe. I hope someone can help me with this issue.
Thank you