pandas value is not numerical judge
时间: 2024-05-15 17:16:45 浏览: 94
If the value in a pandas DataFrame column is not numerical, you can judge it by checking the data type of the column.
You can use `df.dtypes` to check the data type of each column in a DataFrame `df`. If the data type of the column is object or string, then the value is not numerical.
For example, if you have a DataFrame `df` with a column called "age" and you want to check if its values are numerical, you can use the following code:
```
print(df['age'].dtypes)
```
If the output is `int64` or `float64`, then the values are numerical. If the output is `object` or `string`, then the values are not numerical.
阅读全文