Beware of writing if x: when you really mean if x is not None:—e.g., when testing whether a variable or argument that defaults to None was set to some other value. The other value might be a value that's false in a boolean context!
You can use dt.floor for convert to date s and then value_counts or groupby with size : {代码...} 或者: {代码...} 时间: {代码...} 原文由 jezrael 发布,翻译遵循 CC BY-SA 3.0 许可协议