python - Django store csv float items in database -
i have csv file data like:
company,104.95,102.8,102.6,104.5,104.5,102.75...\n
etc.
i storing float values prices[1:len(prices)]
in
models.commaseparatedintegerfield(blank=true, null=true, max_length=10000)
but after values stored, float values quotes '104.95','102.8','102.6','104.5','104.5','102.75'
whereas want store values floats, not strings. how achieve that?
you can convert them floats so:
float_prices = [float(p) p in prices[1:len(prices)]]
that said, commaseparatedintegerfield
validate comma-separated list of integers. neither strings nor floats valid field - it's odd able save data posted.
Comments
Post a Comment