Index de l'article


Avoid indexation problems after dataframes concat

Sometimes after a dataframes concatenation, the indexes are melted and can cause some problems. Just ignore the index in your new dataframe:

df_Selections = pd.concat([firstSelection, secondSelection], axis=0, ignore_index=True)

 Avoid copy warning (example 1)

import warnings
from pandas.core.common import SettingWithCopyWarning
warnings.simplefilter(action='ignore', category=SettingWithCopyWarning)

 Avoid copy warning (example 2)

# Below importations, above your code
pd.options.mode.chained_assignment = None

Avoid user warning 

import warnings
warnings.simplefilter(action='ignore', category=UserWarning)

Avoid future warning

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

Avoid VisibleDeprecationWarning

import warnings
import numpy
warnings.filterwarnings('ignore', category=numpy.VisibleDeprecationWarning)


Liens ou pièces jointes
Télécharger ce fichier ([France-Departements-Deformation]335 Ko
Télécharger ce fichier ([simple_countries]1880 Ko