Open-ET / flux-data-qaqc

Energy Balance Closure Analysis and Eddy Flux Data Post-Processing
BSD 3-Clause "New" or "Revised" License
25 stars 13 forks source link

Can you help please with this TypeError? #25

Closed giswr closed 1 year ago

giswr commented 1 year ago

TypeError Traceback (most recent call last) Cell In[33], line 3 1 # creating a QaQc instance will automatically convert to daily 2 d = Data('US-Tw3_config.ini') ----> 3 q = QaQc(d)

File ~/anaconda3/envs/fluxdataqaqc/lib/python3.11/site-packages/fluxdataqaqc/qaqc.py:290, in QaQc.init(self, data, drop_gaps, daily_frac, max_interp_hours, max_interp_hours_night) 287 self.inv_map[user_G_name] = 'G' 289 # data will be loaded if it has not yet via Data.df --> 290 self.temporal_freq = self._check_daily_freq( 291 drop_gaps, daily_frac, max_interp_hours, max_interp_hours_night 292 ) 293 # check units, convert if possible for energy balance, ppt, Rs, vp, 294 self._check_convert_units()

File ~/anaconda3/envs/fluxdataqaqc/lib/python3.11/site-packages/fluxdataqaqc/qaqc.py:671, in QaQc._check_daily_freq(self, drop_gaps, daily_frac, max_interp_hours, max_interp_hours_night) 668 sum_cols = list(set(sum_cols).intersection(df.columns)) 669 mean_cols = set(df.columns) - set(sum_cols) --> 671 means = df.loc[:,mean_cols].apply( 672 pd.to_numeric, errors='coerce').resample('D').mean().copy() 673 # issue with resample sum of nans, need to drop first else 0 674 sums = df.loc[:,sum_cols].dropna().apply( 675 pd.to_numeric, errors='coerce').resample('D').sum()

File ~/anaconda3/envs/fluxdataqaqc/lib/python3.11/site-packages/pandas/core/indexing.py:1091, in _LocationIndexer.getitem(self, key) 1089 @final 1090 def getitem(self, key): -> 1091 check_dict_or_set_indexers(key) 1092 if type(key) is tuple: 1093 key = tuple(list(x) if is_iterator(x) else x for x in key)

File ~/anaconda3/envs/fluxdataqaqc/lib/python3.11/site-packages/pandas/core/indexing.py:2618, in check_dict_or_set_indexers(key) 2610 """ 2611 Check if the indexer is or contains a dict or set, which is no longer allowed. 2612 """ 2613 if ( 2614 isinstance(key, set) 2615 or isinstance(key, tuple) 2616 and any(isinstance(x, set) for x in key) 2617 ): -> 2618 raise TypeError( 2619 "Passing a set as an indexer is not supported. Use a list instead." 2620 ) 2622 if ( 2623 isinstance(key, dict) 2624 or isinstance(key, tuple) 2625 and any(isinstance(x, dict) for x in key) 2626 ): 2627 raise TypeError( 2628 "Passing a dict as an indexer is not supported. Use a list instead." 2629 )

TypeError: Passing a set as an indexer is not supported. Use a list instead.

JohnVolk commented 1 year ago

@giswr please let me know if the above commit resolved your issue.

giswr commented 1 year ago

Yes It is ok now. Thanks

JohnVolk commented 1 year ago

Great, closing