class_docstr: Result of causal analysis.
class_docstr_tok: ["Result","of","causal","analysis","."]
docstr: Get local causal effects for a given data point.
  
  :param X_test: The data for which the local causal effects
                 needs to be generated for a given point.
  :type X_test: Any
  :return: An object of type CausalData with
           causal effects for a given point.
  :rtype: CausalData
docstr_tok: ["Get","local","causal","effects","for","a","given","data","point",".",":","param","X_test",":","The","data","for","which","the","local","causal","effects","needs","to","be","generated","for","a","given","point",".",":","type","X_test",":","Any",":","return",":","An","object","of","type","CausalData","with","causal","effects","for","a","given","point",".",":","rtype",":","CausalData"]
code: def _local_instance_effects(self, X_test):
      """Get local causal effects for a given data point.
  
      :param X_test: The data for which the local causal effects
                     needs to be generated for a given point.
      :type X_test: Any
      :return: An object of type CausalData with
               causal effects for a given point.
      :rtype: CausalData
      """
      causal_data = self._create_causal_data_object()
  
      local_effects = self.causal_analysis.local_causal_effect(
          X_test, alpha=self.config.alpha, keep_all_levels=True
      )
  
      local_dicts = (
          local_effects.groupby("sample")
          .apply(lambda x: x.reset_index().to_dict(orient="records"))
          .values
      )
      causal_data.local_effects = [list(v) for v in local_dicts]
  
      return causal_data
  
imports: import json
  import re
  import uuid
  from pathlib import Path
  from typing import Any, List, Optional, Tuple, Union
  import pandas
  import semver
  from responsibleai._interfaces import CausalConfig
  from responsibleai._interfaces import CausalData, CausalPolicy, CausalPolicyGains, CausalPolicyTreeInternal, CausalPolicyTreeLeaf, ComparisonTypes
  from responsibleai._internal.constants import FileFormats, SerializationAttributes
  from responsibleai._tools.causal.causal_config import CausalConfig
  from responsibleai._tools.causal.causal_constants import ResultAttributes
  from responsibleai._tools.shared.base_result import BaseResult
  from responsibleai._tools.shared.versions import CausalVersions
label_desc: Use image node_id 7 for calling the CausalResult obj's underlying member method code with example usage: obj._local_instance_effects(X_test) and returns: causal_data