I am trying to decrease the processing time of the std function below. Is there a module I could import that could decrease the processing time for this function? It calculates the standard deviation each of the the iterating 10000 values one by one. Although the std function is fast I am looking to perhaps decrease the processing time by half. The function turns the calculations to numpy arrays at the end.
Variables:
FILE = 'input.csv'
data =pd.read_csv(FILE, low_memory=False)
#reverses all the table data values
data1 = data.iloc[::-1].reset_index(drop=True)
#Columns
PC_list= np.array(data1['Close'])
number = 10000
Function
std= pd.Series(PC_list).rolling(number).std().dropna().to_numpy()
Performance:
Sample of the PC_list data frame:
[386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63
386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63 386.63
378.03 378.03 378.03 378.03 378.03 378.03 378.03 378.03 373. 370.69
370.13 370.13 369.73 369.73 375.41 375.41 375.41 375. 375. 375.
376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95
376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95
376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.95 376.94
376.52 376.52 376.52 376.52 376.52 376.52 376.52 376.52 376.52 376.52
376.52 376.52 371.32 371.32 371.32 371.32 371.32 371.32 371.32 371.32
370.96 370.96 370.96 377.09 377.09 377.09 377.09 378.97 374.39 374.4 ]

