Invalid input of type: ‘dict‘. Convert to a bytes, string, int or float first.

场景

使用哈希类型存不进去redis

redis_deal.hmset("depth", {"asks": asks_list, "bids": bids_list, "time": 1631243542})

报错如下:

Invalid input of type: 'dict'. Convert to a bytes, string, int or float first.

Invalid input of type: 'dict'. Convert to a bytes, string, int or float first.

解决办法:请添加图片描述

卸载redis:

pip3 uninstall redis

安装redis:

pip3 install redis==2.10.6

查看redis的版本:

pip freeze
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 GEE 中,`ee.Image.unitScale()` 函数用于将图像像素值缩放到指定的范围内。在设置上限值 `high` 时,需要确保传递给该参数的值是一个 float 类型的数字,如果传递的是其他类型的对象,就会出现 `Invalid type` 的错误。 根据错误提示信息,你传递给 `high` 参数的值是一个对象,而不是 float 类型的数字。实际上,这个对象的值为 null,这也是错误提示信息中提到的 `actual value`。 为了解决这个问题,你需要检查一下你传递给 `high` 参数的值是不是一个 float 类型的数字。如果不是,可以通过将其转换为 float 类型来解决这个问题。例如,可以使用 `ee.Number()` 函数将对象转换为数字,并使用 `toFloat()` 函数将其转换为 float 类型。以下是示例代码: ``` // Load an image from the GEE ImageCollection var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318'); // Scale the image pixel values to the range [0, 1] var scaledImage = image.unitScale(0, 255).toFloat(); // Scale the image pixel values to the range [0, 10] var highValue = ee.Number(10).toFloat(); var scaledImage2 = image.unitScale(0, 255, 0, highValue); // Print the scaled images print('Scaled Image 1:', scaledImage); print('Scaled Image 2:', scaledImage2); ``` 在这个示例中,我们加载了一个 Landsat 8 的图像,并使用 `unitScale()` 函数将其像素值缩放到了两个不同的范围内。在第一个例子中,我们将像素值缩放到了 [0, 1] 范围内,使用了 `toFloat()` 函数将结果转换为 float 类型。在第二个例子中,我们将像素值缩放到了 [0, 10] 范围内,使用了 `ee.Number()` 和 `toFloat()` 函数将高限值转换为 float 类型。最后,我们将结果打印出来。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值