-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
partial_corr documentation / assertion wrong #387
Comments
partial_corr() assertion checks seem wobbly in general, e.g.:
These come where we yet not know whether covar is a list or a string. If it's a list, truth value is ambiguous. I'd suggest following small changes:
And then in 842:
without trimming the Hope this helps somebody. |
Also, note that in |
Hi @mkeds
Thanks, |
Just a clarification: missing data are dropped with |
The following minimum code example straight from documentation
https://pingouin-stats.org/build/html/generated/pingouin.partial_corr.html#pingouin.partial_corr
Example 1
import pingouin as pg
df = pg.read_dataset('partial_corr')
pg.partial_corr(data=df, x='x', y='y', covar='cv1').round(3)
n r CI95% p-val
pearson 30 0.568 [0.25, 0.77] 0.001
returns:
AssertionError: columns are not in dataframe.
on line 843 from correlation.py:
assert all([c in data for c in col]), "columns are not in dataframe."
which kind of makes sense, because just before in line 842 we have:
col = _flatten_list([x, y, covar, x_covar, y_covar])
and since we don't supply
x_covar y_covar
when calling the function in the example, they default to None in function header, and None in not in the DataFrame by default:In[664]: None in df Out[664]: False
Is this expected behaviour or something wrong with my Pandas? I'm using pandas=2.1.2,
The text was updated successfully, but these errors were encountered: