akelleh / causality

Tools for causal analysis
MIT License
1.06k stars 128 forks source link

Python Package: Problems with Codeline “effect.pdf(x)” #79

Open cschiri opened 4 years ago

cschiri commented 4 years ago

I recently installed the causality package. And, I am working through the example on the package's PyPi page: https://pypi.org/project/causality/

Everything seems to work well until I get to the last line with the code: effect.pdf(x)

I get the KeyError "KeyError: 'b'"

The offending block of code:

> from causality.estimation.nonparametric import CausalEffect
> admissable_set = adjustment.admissable_set(g,['x2'], ['x3'])
> effect = CausalEffect(X, ['x2'], ['x3'], variable_types=variable_types, 
> admissable_set=list(admissable_set))
> x = pd.DataFrame({'x2' : [0.], 'x3' : [0.]})
> effect.pdf(x)

I think it's just a problem with the syntax of the code. I am new to Python and am not able to figure out what it is. Please help

akelleh commented 2 years ago

I'm unable to replicate this bug -- can you share the data generating code you used here?