2

From the comments, I'm realizing this question stems from the fact I only code in python, which is dynamically-typed so I've never had to deal with this.

I'm seeing "downcast" used with regard to the altering of a pandas.DataFrame column-type, from float64 ==> float32. Now...I mean...I think I get the "down" part since 64 > 64/2, but I still don't think I get it completely.

What does "downcast" mean, specifically?

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
Rob Truxal
  • 5,856
  • 4
  • 22
  • 39
  • `float32` is not a subtype of `float64`, therefore it's not downcasting, it's coercion / type conversion. Unclear what you're asking. – Andrey Tyukin May 20 '18 at 20:11
  • lol K well clearly I don't get it. What does downcasting mean? – Rob Truxal May 20 '18 at 20:14
  • I don't know. Python is not statically typed. Does it mean anything at all in Python? I think it's just type coercion / conversion, but some people name it "casting", because it looks syntactically similar to type casting from statically typed languages. – Andrey Tyukin May 20 '18 at 20:16
  • ah so this has to do with pandas DataFrames which use `numpy.dtype`s to represent their field-values. You can do a Ctrl + F, & search for 'downcast' in this article: https://www.dataquest.io/blog/pandas-big-data/ – Rob Truxal May 20 '18 at 20:19
  • @AndreyTyukin This terminology is used in the Pandas docs. See [`pd.to_numeric`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_numeric.html). – miradulo May 20 '18 at 20:19

1 Answers1

0

Since Python does not have a static type system, the term downcasting became free, and is now used in Pandas documentation synonymously with type coercion.

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93