def diffn(self, diffcol: str, name: str="Diff"):
        """
        Add a diff column to the main dataframe: calculate the diff
        from the next value

        :param diffcol: column to diff from
        :type diffcol: str
        :param name: diff column name, defaults to "Diff"
        :type name: str, optional

        :example: ``ds.diffn("Col 1", "New col")``
        """
        try:
            vals = []
            i = 0
            for _, row in self.df.iterrows():
                current = row[diffcol]
                try:
                    nextv = self.df[diffcol].iloc[i + 1]
                except Exception:
                    vals.append(nan)
                    continue
                val = nextv - current
                vals.append(round(val, 1))
                i += 1
            self.add("Diff", vals)
        except Exception as e:
            self.err(e, self._append, "Can not diff column")
            return
        self.ok("Diff column " + name + " added to the dataframe")
def diffn ( self , diffcol : str , name : str = "Diff" ) : try : vals = [ ] i = 0 for _ , row in self . df . iterrows ( ) : current = row [ diffcol ] try : nextv = self . df [ diffcol ] . iloc [ i + 1 ] except Exception : vals . append ( nan ) continue val = nextv - current vals . append ( round ( val , 1 ) ) i += 1 self . add ( "Diff" , vals ) except Exception as e : self . err ( e , self . _append , "Can not diff column" ) return self . ok ( "Diff column " + name + " added to the dataframe" )
Add a diff column to the main dataframe: calculate the diff
        from the next value

        :param diffcol: column to diff from
        :type diffcol: str
        :param name: diff column name, defaults to "Diff"
        :type name: str, optional

        :example: ``ds.diffn("Col 1", "New col")``