我尝试了以下代码:
Input:
v16wk19_1["Datum"] = pd.to_datetime(v16wk19_1["Datum"], dayfirst=True)
v16wk19_1 = v16wk19_1.set_index(v16wk19_1["Datum"])
v16wk19_1 = v16wk19_1.sort_index()
v16wk19_1 = v16wk19_1.drop(["Datum"], axis=1)
v16wk19_1.info()
Output:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 80 entries, 2020-05-07 11:56:40 to 2020-05-07 12:09:50.001000
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 tijd, 10 sec 80 non-null int64
1 Temp cir. 80 non-null float64
2 Temp o.k. 80 non-null float64
3 Druk 80 non-null float64
4 Flow 80 non-null float64
dtypes: float64(4), int64(1)
memory usage: 3.8 KB
DatetimeIndex为: DatetimeIndex:80个条目,2020-05-07 11:56:40至2020-05-07 12:09:50 .001000
,但必须从日期时间中删除 .001000