1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SQL] Connecting Python to Oracle - input contains NaN infinity or a value too large for...

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 21, 2021.

  1. Stack

    Stack Membro Participativo

    I am new in Oracle and Python and I connected my python to Oracle. I had this table on my Oracle database and I wanted to write a simple query to see my result but it gave me this error:

    Input contains NaN, infinity or a value too large for dtype('float64').

    My code:

    SQL_Query2 = pd.read_sql_query('''select Province_name, cnt from Provincepartnercnt''' , conn)
    x_test = pd.DataFrame(SQL_Query2, columns=['Province_name','cnt'])
    SQL_Query = pd.read_sql_query('''select Province_name, cnt from Provincepartnercnt''' , conn)
    x_train = pd.DataFrame(SQL_Query, columns=['Province_name','cnt'])
    myKNN = KNeighborsClassifier(n_neighbors = 1)
    myKNN.fit(x_test, x_train)


    Also my datatype are not float: one of my columns is in VARCHAR2(150 BYTE) and the other one is in NUMBER(38,0). Also I have to mention that non of my rows are null or anything else.

    Continue reading...

Compartilhe esta Página