如何在dataframe python中找到非时间戳数据?

如何在dataframe python中找到非时间戳数据?,python,dataframe,timestamp,Python,Dataframe,Timestamp,以下是时间戳列: TIME 2018-03-02 11:57:37 2018-03-12 10:36:16 2018-03-29 12:02:21 2018-03-23 16:37:08 2018-03-09 22:22:28 . . 我尝试合并,但遇到了以下错误 TypeError: '<' not supported between instances of 'datetime.datetime' and 'int' 我怎样才能解决这个问题 如果

以下是时间戳列:

TIME
2018-03-02 11:57:37
2018-03-12 10:36:16
2018-03-29 12:02:21
2018-03-23 16:37:08
2018-03-09 22:22:28
         .
         .
我尝试合并,但遇到了以下错误

TypeError: '<' not supported between instances of 'datetime.datetime' and 'int'
我怎样才能解决这个问题

如果你能给我一些好的建议,我将不胜感激

这就是我所尝试的

raw_data = pd.merge_ordered(ds,ds2)
#ds2 is similar data like ds

+我认为这可能是db中的解析问题

我相信您需要创建默认索引以防止重复,然后调用:

如有可能,多列:

ds.reset_index(drop=True).drop_duplicates(subset=['TIME'])
尝试使用内置的type()函数。 我不知道这是否正确,但很简单:

if 'datetime' in str(type(ds)):
    print('Is a datetime format')

谢谢你给我一个很好的比较。尽管如此,上面出现的错误仍然没有得到解决。有没有办法解决这个错误?我也没有工作。我使用type()检查所有数据类型,所有数据都是相同的()。解决它太难了ㅜㅜ在我的真实数据中,它没有重复的日期(检查ds.drop\u duplicate()。TypeError:'@송준석 - 你认为是不是应该删除重复项?如果失败,请尝试
ds['TIME']。重置索引(drop=True)。drop\u duplicates()。如果你发电子邮件,我会收到真实的数据。从实际数据来看,问题似乎更清楚了。在我的数据中,str(type(ds))的结果是“”,因此我使用了使用“timestamp”的上层代码,但它也不起作用
ds.reset_index(drop=True).drop_duplicates(subset=['TIME'])
if 'datetime' in str(type(ds)):
    print('Is a datetime format')