-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: 'method' object is not subscriptable #60
Comments
I have the exact same issue |
so it seems it works fine with Python 3.6 and it gives me an error with Python 3.7. the other issue is with networkx it has to be 2.x version to work. which I suggest adding the version of dependencies in the "requirement" file the version of dependencies. |
Thanks for your patience @rghelichi . You are right---this is fixed when network is 2.x. I have updated the requirements.txt now. |
I have tried many solutions but can't seem to solve the problem. This code is in Python 2.7 and I am using Python 3.7. While searching I find out that this gives an error in Python 3.7. Can anyone help me how to remove this error in Python 3.7?
This is the error I am getting:
|
running the first example provided in github page:
Python 3.7.2 (default, Dec 29 2018, 00:00:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import dowhy.api
...: import dowhy.datasets
...:
...: data = dowhy.datasets.linear_dataset(beta=5,
...: num_common_causes=1,
...: num_instruments = 0,
...: num_samples=1000,
...: treatment_is_binary=True)
...:
...: # data['df'] is just a regular pandas.DataFrame
...: data['df'].causal.do(x='v',
...: variable_types={'v': 'b', 'y': 'c', 'X0': 'c'},
...: outcome='y',
...: common_causes=['X0']).groupby('v').mean().plot(y='y', kind='bar')
...:
...:
WARNING:dowhy.do_why:Causal Graph not provided. DoWhy will construct a graph based on data inputs.
TypeError Traceback (most recent call last)
in ()
12 variable_types={'v': 'b', 'y': 'c', 'X0': 'c'},
13 outcome='y',
---> 14 common_causes=['X0']).groupby('v').mean().plot(y='y', kind='bar')
15
16
~/Documents/projects/dowhy/dowhy/api/causal_data_frame.py in do(self, x, method, num_cores, variable_types, outcome, params, dot_graph, common_causes, estimand_type, proceed_when_unidentifiable, stateful)
88 instruments=None,
89 estimand_type=estimand_type,
---> 90 proceed_when_unidentifiable=proceed_when_unidentifiable)
91 #self._identified_estimand = self._causal_model.identify_effect()
92 if not self._sampler:
~/Documents/projects/dowhy/dowhy/do_why.py in init(self, data, treatment, outcome, graph, common_causes, instruments, estimand_type, proceed_when_unidentifiable, **kwargs)
79 self._outcome,
80 common_cause_names=self._common_causes,
---> 81 observed_node_names=self._data.columns.tolist()
82 )
83 elif instruments is not None:
~/Documents/projects/dowhy/dowhy/causal_graph.py in init(self, treatment_name, outcome_name, graph, common_cause_names, instrument_names, observed_node_names)
65 raise ValueError
66
---> 67 self._graph = self.add_node_attributes(observed_node_names)
68 self._graph = self.add_unobserved_common_cause(observed_node_names)
69
~/Documents/projects/dowhy/dowhy/causal_graph.py in add_node_attributes(self, observed_node_names)
116 for node_name in self._graph:
117 if node_name in observed_node_names:
--> 118 self._graph.nodes[node_name]["observed"] = "yes"
119 else:
120 self._graph.nodes[node_name]["observed"] = "no"
TypeError: 'method' object is not subscriptable
The text was updated successfully, but these errors were encountered: