简体   繁体   English

类型错误:float() 参数必须是字符串或数字,而不是“Day”

[英]TypeError: float() argument must be a string or a number, not 'Day'

I've been getting the error:我一直收到错误:

TypeError: float() argument must be a string or a number, not 'Day'.类型错误:float() 参数必须是字符串或数字,而不是“天”。

Does anyone know how I can resolve this?有谁知道我该如何解决这个问题?

https://lifetimes.readthedocs.io/en/latest/Quickstart.html https://lifetimes.readthedocs.io/en/latest/Quickstart.html

from lifetimes.datasets import load_transaction_data
from lifetimes.utils import summary_data_from_transaction_data

transaction_data = load_transaction_data()
print(transaction_data.head())
"""
                  date  id
0  2014-03-08 00:00:00   0
1  2014-05-21 00:00:00   1
2  2014-03-14 00:00:00   2
3  2014-04-09 00:00:00   2
4  2014-05-21 00:00:00   2
"""


summary = summary_data_from_transaction_data(transaction_data, 'id', 'date', observation_period_end='2014-12-31')

print(summary.head())

You might have resolved this on your own - but thought to post it for anyone facing this issue.您可能已经自己解决了这个问题 - 但想把它发布给任何面临这个问题的人。

I faced the exact same issue but the reason was that I was using an older version of the Lifetimes package.我遇到了完全相同的问题,但原因是我使用的是旧版本的 Lifetimes 包。 I was able to resolve it after updating Lifetimes to version 0.11.1 .将 Lifetimes 更新到版本 0.11.1后,我能够解决它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型错误:float() 参数必须是字符串或数字,而不是“配置文件” - TypeError: float() argument must be a string or a number, not 'Profile' 类型错误:float() 参数必须是字符串或数字,而不是“Period” - TypeError: float() argument must be a string or a number, not 'Period' TypeError:float()参数必须是字符串或数字,而不是'方法' - TypeError: float() argument must be a string or a number, not 'method' TypeError:float() 参数必须是字符串或数字,而不是“SimpleImputer” - TypeError: float() argument must be a string or a number, not 'SimpleImputer' TypeError:float() 参数必须是字符串或数字,而不是“类型” - TypeError: float() argument must be a string or a number, not 'type' TypeError: float() 参数必须是字符串或数字,而不是“Tensor” - TypeError: float() argument must be a string or a number, not 'Tensor' TypeError:float()参数必须是字符串或数字,而不是“ NaTType” - TypeError: float() argument must be a string or a number, not 'NaTType' 类型错误:float() 参数必须是字符串或数字,而不是“列表” - TypeError: float() argument must be a string or a number, not 'list' TypeError:float()参数必须是字符串或数字 - TypeError: float() argument must be a string or a number TypeError:float()参数必须是字符串或数字,而不是'IntVar' - TypeError: float() argument must be a string or a number, not 'IntVar'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM