docstr: Filter the columns of a DataFrame to those specified in an SQL query.
  Args:
      result (pandas.DataFrame): The DataFrame to filter.
      query (ast.Select): The SQL query containing the column names to filter on.
docstr_tok: ["Filter","the","columns","of","a","DataFrame","to","those","specified","in","an","SQL","query",".","Args",":","result","(","pandas.DataFrame",")",":","The","DataFrame","to","filter",".","query","(","ast.Select",")",":","The","SQL","query","containing","the","column","names","to","filter","on","."]
code: def filter_columns(
      self, result: pd.DataFrame, query: ast.Select = None
  ) -> None:
      """Filter the columns of a DataFrame to those specified in an SQL query.
      Args:
          result (pandas.DataFrame): The DataFrame to filter.
          query (ast.Select): The SQL query containing the column names to filter on.
      """
      if query is None:
          return
  
      columns = []
      for target in query.targets:
          if isinstance(target, ast.Star):
              return
          elif isinstance(target, ast.Identifier):
              columns.append(target.value)
  
      if len(columns) > 0:
          result = result[columns]
  
imports: import pandas
  from mindsdb.integrations.libs.api_handler import APITable
  from mindsdb_sql.parser import ast
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from typing import List, Tuple
  import requests
label_desc: Use image node_id 3 for calling the CommentsTable obj's underlying member method code with example usage: obj.filter_columns(result, query) without return types