0

When using read_sql in pandas, some None data from DB will be converted to 0/Nan, while other None stay as None.

  • Q #1: how does pandas determine when to convert None to zero or None to Nan, and when not to convert None (leave as is)

I understand that I can set coerce_float=False to disable this auto-conversion.

  • Q #2 I wonder, is there a way to just avoid converting None data but still try converting other not-None data?

Note:

  1. Sorry, I don't have the required reputation to add pandas tag. Please help if you can.
NotAName
  • 3,821
  • 2
  • 29
  • 44
SimonInNYC
  • 400
  • 3
  • 15
  • I would assume that pandas would convert None to NaN in cases where "None" is a placeholder for missing value. If it's a string, for example, it should be read as-is. – NotAName May 11 '21 at 00:36
  • https://stackoverflow.com/questions/17534106/what-is-the-difference-between-nan-and-none – Priyank May 11 '21 at 02:12

0 Answers0