python - Inserting NaN value into MySQL Database -


i have data contains nulls, floats , occasional nan. i'm trying insert data mysql database using python , mysqldb.

here's insert statement:

for row in zip(currents, voltages):         row = [id] + list(row)         item in row:             sql_insert = ('insert result(id, current, voltage)'                             'values(%s, "%s")')             cursor.execute(sql_insert, row) 

this table:

create table langmuir_result (result_id int auto_increment,                                id int,                                current float,                               voltage float,                               primary key (result_id)); 

when try insert nan table error:

_mysql_exceptions.dataerror: (1265, "data truncated column 'current' @ row 1") 

i want insert nan values database float or number, not string or null. i've tried having type of column float , decimal same error. how can without making string or null? possible?

no, it's not possible store nan value in float type columns in mysql. values allowed null or number. may solve using value don't use nan (maybe negatives, big/low value)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -