首页 > 解决方案 > 0. 在 Python 中是什么意思?

问题描述

我是初学者 python 用户。有人可以解释这段代码是什么意思吗?

harvest["year"] = harvest.index.year
harvest["DM"] = harvest["N"] = 0.

harvest, year,DMN是数据和数据变量。这里是什么0.意思?

标签: python

解决方案


>>> type(0)
<class 'int'>
>>> type(0.)
<class 'float'>

它只是确保结果虽然仍然是“零”,但它是float 而不是 int


推荐阅读