File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 105
105
is_sequence ,
106
106
needs_i8_conversion ,
107
107
pandas_dtype ,
108
+ is_timedelta64_dtype ,
109
+ is_datetime64_any_dtype ,
108
110
)
109
111
from pandas .core .dtypes .concat import concat_compat
110
112
from pandas .core .dtypes .dtypes import (
@@ -11267,10 +11269,11 @@ def cov(
11267
11269
c -0.150812 0.191417 0.895202
11268
11270
"""
11269
11271
data = self ._get_numeric_data () if numeric_only else self
11270
- if data .select_dtypes (include = [np .datetime64 , np .timedelta64 ]).shape [1 ] > 0 :
11272
+ dtypes = [blk .dtype for blk in self ._mgr .blocks ]
11273
+ if any (is_datetime64_any_dtype (d ) or is_timedelta64_dtype (d ) for d in dtypes ):
11271
11274
msg = (
11272
- "DataFrame contains columns with dtype datetime64[ns] "
11273
- "or timedelta64[ns] , which are not supported for cov."
11275
+ "DataFrame contains columns with dtype datetime64 "
11276
+ "or timedelta64, which are not supported for cov."
11274
11277
)
11275
11278
raise TypeError (msg )
11276
11279
cols = data .columns
You can’t perform that action at this time.
0 commit comments