1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to change Pandas dataframe column name from 'NaN' to something else

Discussão em 'Python' iniciado por Stack, Setembro 15, 2025.

  1. Stack

    Stack Membro Participativo

    I have tried to string the column names and then change them -- no success, it left it NaN:

    data.rename(columns=str).rename(columns={'NaN':'Tip Analiza','NaN':'Limite' }, inplace=True)


    I tried to use the in function to replace NaN-- no success, it gave an error:

    data.columns = pd.Series([np.nan if 'Unnamed:' in x else x for x in data.columns.values]).ffill().values.flatten()


    TypeError: argument of type 'float' is not iterable
    ​

    What should I try?

    Continue reading...

Compartilhe esta Página