[英]AttributeError: 'DataFrame' object has no attribute 'get_dtype_counts'
I want to see the counts of the datatype in a DataFrame using get_dtype_counts()
method but it is giving error.我想使用
get_dtype_counts()
方法查看 DataFrame 中数据类型的计数,但它给出了错误。 Please help.请帮忙。
import pandas as pd
import numpy as np
df = pd.DataFrame(np.arange(5))
df
Output Output
0
0 0
1 1
2 2
3 3
4 4
Error错误
df.get_dtype_counts()
AttributeError Traceback (most recent call last)
<ipython-input-9-aa9a46562585> in <module>()
1 df = pd.DataFrame(np.arange(5))
----> 2 df.get_dtype_counts()
3 # df
/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in __getattr__(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.__getattribute__(self, name)
5275
5276 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'get_dtype_counts'
.get_dtype_counts()
is deprecated since 0.25.0 , use .dtypes.value_counts()
instead .get_dtype_counts()
自 0.25.0 起已弃用,请改用.dtypes.value_counts()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.