parameters: (self, periods=1, axis=0)
return_statement: return self - self.shift(periods=periods)
docstring: First discrete difference of element.
  
          Calculates the difference of a DataFrame element compared with another
          element in the DataFrame (default is element in previous row).
  
          Parameters
          ----------
          periods : int, default 1
              Periods to shift for calculating difference,
              accepts negative values.
          axis : {0 or 'index', 1 or 'columns'}, default 0
              Take difference over rows (0) or columns (1).
              Only row-wise (0) shift is supported.
  
          Returns
          -------
          DataFrame
              First differences of the DataFrame.
  
          Notes
          -----
          Diff currently only supports numeric dtype columns.
  
          Examples
          --------
          >>> import cudf
          >>> gdf = cudf.DataFrame({'a': [1, 2, 3, 4, 5, 6],
          ...                       'b': [1, 1, 2, 3, 5, 8],
          ...                       'c': [1, 4, 9, 16, 25, 36]})
          >>> gdf
             a  b   c
          0  1  1   1
          1  2  1   4
          2  3  2   9
          3  4  3  16
          4  5  5  25
          5  6  8  36
          >>> gdf.diff(periods=2)
                a     b     c
          0  <NA>  <NA>  <NA>
          1  <NA>  <NA>  <NA>
          2     2     1     8
          3     2     2    12
          4     2     3    16
          5     2     5    20
docstring_summary: First discrete difference of element.
docstring_tokens: First discrete difference of element .
function: def diff(self, periods=1, axis=0):
          """
          First discrete difference of element.
  
          Calculates the difference of a DataFrame element compared with another
          element in the DataFrame (default is element in previous row).
  
          Parameters
          ----------
          periods : int, default 1
              Periods to shift for calculating difference,
              accepts negative values.
          axis : {0 or 'index', 1 or 'columns'}, default 0
              Take difference over rows (0) or columns (1).
              Only row-wise (0) shift is supported.
  
          Returns
          -------
          DataFrame
              First differences of the DataFrame.
  
          Notes
          -----
          Diff currently only supports numeric dtype columns.
  
          Examples
          --------
          >>> import cudf
          >>> gdf = cudf.DataFrame({'a': [1, 2, 3, 4, 5, 6],
          ...                       'b': [1, 1, 2, 3, 5, 8],
          ...                       'c': [1, 4, 9, 16, 25, 36]})
          >>> gdf
             a  b   c
          0  1  1   1
          1  2  1   4
          2  3  2   9
          3  4  3  16
          4  5  5  25
          5  6  8  36
          >>> gdf.diff(periods=2)
                a     b     c
          0  <NA>  <NA>  <NA>
          1  <NA>  <NA>  <NA>
          2     2     1     8
          3     2     2    12
          4     2     3    16
          5     2     5    20
  
          """
          if not is_integer(periods):
              if not (is_float(periods) and periods.is_integer()):
                  raise ValueError("periods must be an integer")
              periods = int(periods)
  
          axis = self._get_axis_from_axis_arg(axis)
          if axis != 0:
              raise NotImplementedError("Only axis=0 is supported.")
  
          if not all(is_numeric_dtype(i) for i in self.dtypes):
              raise NotImplementedError(
                  "DataFrame.diff only supports numeric dtypes"
              )
  
          if abs(periods) > len(self):
              df = cudf.DataFrame._from_data(
                  {
                      name: column_empty(len(self), dtype=dtype, masked=True)
                      for name, dtype in zip(self.columns, self.dtypes)
                  }
              )
              return df
  
          return self - self.shift(periods=periods)
function_tokens: def diff ( self , periods = 1 , axis = 0 ) : if not is_integer ( periods ) : if not ( is_float ( periods ) and periods . is_integer ( ) ) : raise ValueError ( "periods must be an integer" ) periods = int ( periods ) axis = self . _get_axis_from_axis_arg ( axis ) if axis != 0 : raise NotImplementedError ( "Only axis=0 is supported." ) if not all ( is_numeric_dtype ( i ) for i in self . dtypes ) : raise NotImplementedError ( "DataFrame.diff only supports numeric dtypes" ) if abs ( periods ) > len ( self ) : df = cudf . DataFrame . _from_data ( { name : column_empty ( len ( self ) , dtype = dtype , masked = True ) for name , dtype in zip ( self . columns , self . dtypes ) } ) return df return self - self . shift ( periods = periods )