I've noticed DABEST does not let me work with dataframes where column names are not strings.
example:
import dabest
import pandas as pd
import numpy as np
from itertools import combinations
from pprint import pprint
print(dabest.__version__)
columns = [1, 2.0]
# create a test database
N = 100
df = pd.DataFrame(np.vstack([np.random.normal(loc=i, size=(N,)) for i in range(len(columns))]).T, columns=columns)
db = dabest.load(data=df, idx=columns)
print(db.mean_diff)
results in an Exception:
0.3.0
Traceback (most recent call last):
File "<ipython-input-10-19e1ff62e09f>", line 14, in <module>
db = dabest.load(data=df, idx=columns)
File "/.../anaconda3/lib/python3.7/site-packages/dabest/_api.py", line 65, in load
return Dabest(data, idx, x, y, paired, id_col, ci, resamples, random_seed)
File "/.../anaconda3/lib/python3.7/site-packages/dabest/_classes.py", line 67, in __init__
raise ValueError(err)
ValueError: There seems to be a problem with the idx you
As far as I understand, any hashable can be used as a column name (an Index really). I'm not sure what use case there is for exotic types, but I often have columns that are named with int or float.
I'm going to propose a fix, but I'm not entirely sure the solution is robust. I'm would test for Hashable instead of str, but some iterables are hashables (frozensets, tuples, range) and I don't quite know how you'd deal with that.
PLUS there is an independent but related bug in pandas that prevents the fix from working. See here. The bug was fixed in v.1.0.0 and DABEST would need to require that version to work properly.
I've noticed DABEST does not let me work with dataframes where column names are not strings.
example:
results in an Exception:
As far as I understand, any hashable can be used as a column name (an
Indexreally). I'm not sure what use case there is for exotic types, but I often have columns that are named withintorfloat.I'm going to propose a fix, but I'm not entirely sure the solution is robust. I'm would test for
Hashableinstead ofstr, but some iterables are hashables (frozensets, tuples, range) and I don't quite know how you'd deal with that.PLUS there is an independent but related bug in pandas that prevents the fix from working. See here. The bug was fixed in v.1.0.0 and DABEST would need to require that version to work properly.