python - Compute forward difference with Dask DataFrame? -


how compute first discrete difference using dask dataframe? or, in "pandas speak", how do pandas.dataframe.diff() in dask? mathematically, operation simple: subtract column vector copy of shifted 1 or more rows.

i have tried implementing diff() in dask in following ways, none of works (yet):

  • df - df.shift(periods=1) works in pandas. dask dataframe doesn't have shift() method.
  • df.values[:-1] - df.values[1:] works in pandas. can't see how index dask dataframe position.

my current best idea implementing diff wrap custom code in dask.dataframe.rolling.wrap_rolling, suggested in this stack overflow answer (although haven't been able find documentation on how this). or wrap custom code using dask delayed? other thoughts?

the diff method has been added both dataframe , series, in pr: https://github.com/dask/dask/pull/1769. works same in pandas.


Comments

Popular posts from this blog

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -