data = data.groupby([pd.Grouper(key='Timestamp', freq='D')]).first().reset_index()
报错提示如下:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-34-bb950f0a9cc9> in <module> ----> 1 data = data.groupby([pd.Grouper(key='Timestamp', freq='D')]).first().reset_index() ~\Anaconda3\lib\site-packages\pandas\core\frame.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, dropna) 6725 squeeze=squeeze, 6726 observed=observed, -> 6727 dropna=dropna, 6728 ) 6729 ~\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py in __init__(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze, observed, mutated, dropna) 566 observed=observed, 567 mutated=self.mutated, --> 568 dropna=self.dropna, 569 ) 570 ~\Anaconda3\lib\site-packages\pandas\core\groupby\grouper.py in get_grouper(obj, key, axis, level, sort, observed, mutated, validate, dropna) 837 dropna=dropna, 838 ) --> 839 if not isinstance(gpr, Grouping) 840 else gpr 841 ) ~\Anaconda3\lib\site-packages\pandas\core\groupby\grouper.py in __init__(self, index, grouper, obj, name, level, sort, observed, in_axis, dropna) 492 # check again as we have by this point converted these 493 # to an actual value (rather than a pd.Grouper) --> 494 _, grouper, _ = self.grouper._get_grouper(self.obj, validate=False) 495 if self.name is None: 496 self.name = grouper.result_index.name ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _get_grouper(self, obj, validate) 1483 # create the resampler and return our binner 1484 r = self._get_resampler(obj) -> 1485 r._set_binner() 1486 return r.binner, r.grouper, r.obj 1487 ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _set_binner(self) 193 """ 194 if self.binner is None: --> 195 self.binner, self.grouper = self._get_binner() 196 197 def _get_binner(self): ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _get_binner(self) 200 has already been called. 201 """ --> 202 binner, bins, binlabels = self._get_binner_for_time() 203 assert len(bins) == len(binlabels) 204 bin_grouper = BinGrouper(bins, binlabels, indexer=self.groupby.indexer) ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _get_binner_for_time(self) 1040 if self.kind == "period": 1041 return self.groupby._get_time_period_bins(self.ax) -> 1042 return self.groupby._get_time_bins(self.ax) 1043 1044 def _downsample(self, how, **kwargs): ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _get_time_bins(self, ax) 1503 closed=self.closed, 1504 origin=self.origin, -> 1505 offset=self.offset, 1506 ) 1507 # GH #12037 ~\Anaconda3\lib\site-packages\pandas\core\resample.py in _get_timestamp_range_edges(first, last, freq, closed, origin, offset) 1744 """ 1745 if isinstance(freq, Tick): -> 1746 index_tz = first.tz 1747 if isinstance(origin, Timestamp) and (origin.tz is None) != (index_tz is None): 1748 raise ValueError("The origin must have the same timezone as the index.") AttributeError: 'NaTType' object has no attribute 'tz'