Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Classe « Index »

Méthode pandas.Index.diff

Signature de la méthode diff

def diff(self, periods: 'int' = 1) -> 'Index' 

Description

help(Index.diff)

Computes the difference between consecutive values in the Index object.

If periods is greater than 1, computes the difference between values that
are `periods` number of positions apart.

Parameters
----------
periods : int, optional
    The number of positions between the current and previous
    value to compute the difference with. Default is 1.

Returns
-------
Index
    A new Index object with the computed differences.

Examples
--------
>>> import pandas as pd
>>> idx = pd.Index([10, 20, 30, 40, 50])
>>> idx.diff()
Index([nan, 10.0, 10.0, 10.0, 10.0], dtype='float64')



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé