serenajiang commented on a change in pull request #8138: [typing] add typing 
for superset/connectors and superset/common
URL: 
https://github.com/apache/incubator-superset/pull/8138#discussion_r319208187
 
 

 ##########
 File path: superset/common/query_context.py
 ##########
 @@ -109,17 +114,17 @@ def get_query_result(self, query_object):
             "df": df,
         }
 
-    def df_metrics_to_num(self, df, query_object):
+    def df_metrics_to_num(self, df: pd.DataFrame, query_object: QueryObject) 
-> None:
         """Converting metrics to numeric when pandas.read_sql cannot"""
         metrics = [metric for metric in query_object.metrics]
         for col, dtype in df.dtypes.items():
             if dtype.type == np.object_ and col in metrics:
                 df[col] = pd.to_numeric(df[col], errors="coerce")
 
-    def get_data(self, df):
+    def get_data(self, df: pd.DataFrame) -> List[Dict]:
 
 Review comment:
   `orient=records` makes `DataFrame.to_dict` return a list of dicts.
   
   I, too, was very confused.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to