numpy.int64' object has no attribute 'drop'
时间: 2023-09-11 22:08:59 浏览: 140
`numpy.int64` is a data type for integers in numpy, and it does not have a `drop` attribute. It seems like you are trying to use the `drop` method on a `numpy.int64` object, which is not possible.
`drop` method is a function that is available for pandas dataframe objects to remove rows or columns. If you want to use `drop` method, you need to make sure that you are using it on a pandas dataframe object, not on a numpy int64 object.
Here's an example of how to use the `drop` method on a pandas dataframe:
```
import pandas as pd
# create a dataframe
data = {'Name': ['John', 'Emily', 'Charlie', 'Lucy'],
'Age': [25, 30, 18, 21]}
df = pd.DataFrame(data)
# drop a column
df.drop('Age', axis=1, inplace=True)
# drop a row
df.drop(0, axis=0, inplace=True)
```
In this example, we create a pandas dataframe from a dictionary and then use the `drop` method to remove a column and a row. Note that the `inplace=True` argument is used to modify the dataframe in place.
阅读全文