python - How to apply numpy vectorize on a array of dataframes? -
myfunc processes on dataframe. trying reduce computational time vectorzing myfunc. each dataframe created reading large text file(30 gigs). tried create array of dataframes , vectorize myfunc can apply on array of dataframes, problem np.vectorize applies on each cell of dataframe not on whole dataframe. though, columns of dataframe array, np.vectorize applies myfunc on each cell inside array not on whole array. not sure right way solve problem. please share thoughts. thank you.
import numpy np import pandas pd def myfunc(a): # process on dataframe return a*2 vecfunc = np.vectorize(myfunc) x = pd.dataframe(np.array([[1,2,3],[1,2,3]])) y = pd.dataframe(np.array([[1,2,3],[1,2,3]])) z = pd.dataframe(np.array([[1,2,3],[1,2,3]])) result = vecfunc([x,y,z]) print(result)
Comments
Post a Comment