pandas timestamp转化为date
时间: 2023-04-27 13:04:20 浏览: 149
pandas中Timestamp类用法详解
可以使用to_datetime()方法将pandas timestamp转化为date。例如:
```python
import pandas as pd
# 创建一个pandas timestamp
ts = pd.Timestamp('2021-10-01 12:00:00')
# 将pandas timestamp转化为date
date = pd.to_datetime(ts).date()
print(date)
```
输出结果为:
```
2021-10-01
```
阅读全文