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 390 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  How to express null value klatlap 3 884 Mar-25-2023, 10:40 AM
Last Post: klatlap
Photo How to select NULL and blank values from MySQL table into csv python300 9 2,549 Dec-27-2022, 09:43 PM
Last Post: deanhystad
  formatting float like int for whole values Skaperen 8 1,805 Apr-11-2022, 01:56 PM
Last Post: deanhystad
  Float Slider - Affecting Values in Column 'Pandas' planckepoch86 0 1,429 Jan-22-2022, 02:18 PM
Last Post: planckepoch86
  value null when update in json file 3lnyn0 6 3,393 Dec-30-2021, 05:52 PM
Last Post: ndc85430
  Error : "can't multiply sequence by non-int of type 'float' " Ala 3 3,119 Apr-13-2021, 10:33 AM
Last Post: deanhystad
  Multiple conditions, one is null moralear27 1 2,225 Sep-13-2020, 06:11 AM
Last Post: scidam
  I didnt get the NULL values salwa17 0 1,609 Jul-10-2020, 02:54 PM
Last Post: salwa17
  Find only the rows containing null values Bhavika 2 2,474 Jun-10-2020, 01:25 PM
Last Post: Bhavika

Forum Jump:

User Panel Messages

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