Respostas no Fórum

Visualizando 3 posts - 1 até 3 (de 3 do total)
  • Autor
    Posts
  • em resposta a: Pré processamento erros conforme abaixo mostrados #42884
    MARCELO TORRES
    Participante

      Chatgpt

      X_all.columns = X_all.columns.astype(str)

      RESOLVIDO

      em resposta a: Pré processamento erros conforme abaixo mostrados #42883
      MARCELO TORRES
      Participante

        print(X_all.dtypes)

        a coluna overtime está como objeto

         

        NumCompaniesWorked int64

        OverTime object

        PercentSalaryHike int64

        PerformanceRating int64

        em resposta a: Pré processamento erros conforme abaixo mostrados #42882
        MARCELO TORRES
        Participante

          Tive o mesmo erro troque o nome da variáveis , coloquei X, x, Nada resolveu.

          Reuniciei a maquina, o collab, tudo

          A mensagem diz que tem dados em formato de string provavelmente no x_cat.

          Reconverti tudo mas deu o mesmo erro

          —————————————————————————

          TypeError Traceback (most recent call last)

          <ipython-input-75-3e293ed36e51> in <cell line: 3>()
          1 from sklearn.preprocessing import MinMaxScaler
          2 scaler = MinMaxScaler()
          —-> 3 X = scaler.fit_transform(X_all)

          6 frames
          /usr/local/lib/python3.10/dist-packages/sklearn/utils/validation.py in _get_feature_names(X)
          1901 # mixed type of string and non-string is not supported
          1902 if len(types) > 1 and “str” in types:
          -> 1903 raise TypeError(
          1904 “Feature names are only supported if all input features have string names, ”
          1905 f”but your input has {types} as feature name / column name types. ”

          TypeError: Feature names are only supported if all input features have string names, but your input has [‘int’, ‘str’] as feature name / column name types. If you want feature names to be stored and validated, you must convert them all to strings, by using X.columns = X.columns.astype(str) for example. Otherwise you can remove feature / column names from your input data, or convert them all to a non-string data type.

        Visualizando 3 posts - 1 até 3 (de 3 do total)