Python Forum
Write Null values as 0.0 (float) type in csv
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write Null values as 0.0 (float) type in csv
#4
Use pandas instead of csv. When reading the csv into a DataFrame you can use DataFrame.fillna() to replace NaN with some value.

I don't understand why you are using csv files at all. From all your posts it sounds like you are getting information from a database and writing it to a CSV file only to read the CSV file and store the information in a database. Why?
Reply


Messages In This Thread
RE: Write Null values as 0.0 (float) type in csv - by deanhystad - Dec-07-2022, 09:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 2,424 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  How to express null value klatlap 3 2,151 Mar-25-2023, 10:40 AM
Last Post: klatlap
Photo How to select NULL and blank values from MySQL table into csv python300 9 5,755 Dec-27-2022, 09:43 PM
Last Post: deanhystad
  formatting float like int for whole values Skaperen 8 3,431 Apr-11-2022, 01:56 PM
Last Post: deanhystad
  Float Slider - Affecting Values in Column 'Pandas' planckepoch86 0 2,087 Jan-22-2022, 02:18 PM
Last Post: planckepoch86
  Error : "can't multiply sequence by non-int of type 'float' " Ala 3 4,220 Apr-13-2021, 10:33 AM
Last Post: deanhystad
  Multiple conditions, one is null moralear27 1 2,915 Sep-13-2020, 06:11 AM
Last Post: scidam
  I didnt get the NULL values salwa17 0 2,048 Jul-10-2020, 02:54 PM
Last Post: salwa17
  Find only the rows containing null values Bhavika 2 3,251 Jun-10-2020, 01:25 PM
Last Post: Bhavika
  access dictionary with keys from another and write values to list redminote4dd 6 4,770 Jun-03-2020, 05:20 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020