嗨,我在与seaborn约会时遇到了麻烦。我试图用x作为数据类型class NetworkRequest<T: Codable> {
var objectClass: T.Type!
init(objectClass : T.Type) {
self.objectClass = objectClass
}
}
class Person : Codable {
var name:String?
}
let request = NetworkRequest<Person>(objectClass: Person.self)
let response : Dictionary<String,Any> = ["name":"test"]
let data : Data = try! JSONSerialization.data(withJSONObject: response,options: [])
do {
let person = try JSONDecoder().decode(request.objectClass, from: data)
print(person.name ?? "--")
} catch {
print(error)
}
绘制分类数据,但出现以下错误:
datetime.time
这是我的df:
float() argument must be a string or a number, not 'datetime.time'
这是我的代码:
toronto_time description
0 00:00:50 STATS
1 00:01:55 STATS
2 00:02:18 ONLINE
3 00:05:24 STATS
4 00:05:34 STATS
5 00:06:33 OFFLINE
更新:
'toronto_time'的dtype是一个对象。当我使用pd.to_datetime时,它将转换为datetime,但是会添加一个日期。