Newest questions tagged python - Stack Overflow
How to compute a gradient column-wise in a pandas DataFrame using the index as an input?
I'd like to compute the gradient of a DataFrame, for which I can gather that the best method is to use .apply(), e.g: df = pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]]) df = df.apply(np.gradient) print(df) Output: 0 1
View original source