neurostats-API 0.0.24__py3-none-any.whl → 0.0.25__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -355,8 +355,6 @@ class InstitutionFetcher(StatsFetcher):
355
355
  result = self.tej_collection.aggregate(pipeline)
356
356
  result = result.to_list()
357
357
 
358
- result_df = pd.DataFrame(result[0]['filtered_data'])
359
-
360
358
  proj_columns = {
361
359
  "mdate": "date",
362
360
  "qfii_buy": "外資買進股數",
@@ -373,6 +371,11 @@ class InstitutionFetcher(StatsFetcher):
373
371
  "dlrh_ex" : "自營買賣超股數(避險)",
374
372
  "tot_ex" : "三大法人買賣超股數"
375
373
  }
374
+
375
+ try:
376
+ result_df = pd.DataFrame(result[0]['filtered_data'])
377
+ except Exception as e:
378
+ result_df = pd.DataFrame(columns = list(proj_columns.keys()))
376
379
 
377
380
  target_index = list(proj_columns.keys())[1:]
378
381
  result_df.loc[:, target_index] = result_df.loc[:, target_index].map(lambda x : 1000 * x) # TEJ單位為千股