(Jun-15-2021, 01:26 PM)ju21878436312 Wrote: hank you. I actually need to further evaluate the data. And if I try it directly with data, I get:You need to get thee DataFrame out of tuple.
Here a example with some advice.
import pandas as pd import numpy as np # Pandas has own datateime do not need to use this #from datetime import datetime, timedelta # read data, date_parser=[0]: first column to datetime, data = pd.read_csv('minimal_data.csv', delimiter = ';', date_parser=[0], usecols=[0, 1], header=0, names=["MyColumn1","MyColumn2"]), # Get DataFrame out of tupe df = data[0] # Convert to datetime64 df['MyColumn1'] = pd.to_datetime(df['MyColumn1']) print(df.dtypes) print(df) print('-' * 30) print(df.loc[df['MyColumn2'] == 0])
Output:MyColumn1 datetime64[ns]
MyColumn2 int64
dtype: object
MyColumn1 MyColumn2
0 2021-09-06 14:35:05 178
1 2021-09-06 14:36:16 59
2 2021-09-06 14:37:26 0
3 2021-09-06 14:38:37 0
4 2021-09-06 14:39:48 0
5 2021-09-06 14:40:59 0
6 2021-09-06 14:42:10 0
7 2021-09-06 14:43:21 0
8 2021-09-06 14:44:32 0
------------------------------
MyColumn1 MyColumn2
2 2021-09-06 14:37:26 0
3 2021-09-06 14:38:37 0
4 2021-09-06 14:39:48 0
5 2021-09-06 14:40:59 0
6 2021-09-06 14:42:10 0
7 2021-09-06 14:43:21 0
8 2021-09-06 14:44:32 0