alteryx / categorical_encoding

Repository for the research and implementation of categorical encoding into a Featuretools-compatible Python library
BSD 3-Clause "New" or "Revised" License
50 stars 15 forks source link

calculate_feature_matrix #5

Open Alla-Abdella opened 4 years ago

Alla-Abdella commented 4 years ago

#5 Comment: I fixed this issue by updating pandas: pip install pandas==0.24.0

es = make_ecommerce_entityset() f1 = ft.Feature(es["log"]["product_id"]) f2 = ft.Feature(es["log"]["purchased"]) f3 = ft.Feature(es["log"]["value"]) f4 = ft.Feature(es["log"]["countrycode"])

features = [f1, f2, f3, f4] ids = [0, 1, 2, 3, 4, 5] feature_matrix = ft.calculate_feature_matrix(features, es, instance_ids=ids) print(feature_matrix)

The error:


AttributeError Traceback (most recent call last)

in 1 feature_matrix = ft.calculate_feature_matrix(features, es, ----> 2 instance_ids=ids) /anaconda/envs/azureml_py36/lib/python3.6/site-packages/featuretools/computational_backends/calculate_feature_matrix.py in calculate_feature_matrix(features, entityset, cutoff_time, instance_ids, entities, relationships, cutoff_time_in_index, training_window, approximate, save_progress, verbose, chunk_size, n_jobs, dask_kwargs, progress_callback) 281 282 # ensure rows are sorted by input order --> 283 feature_matrix = feature_matrix.reindex(pd.MultiIndex.from_frame(cutoff_time[["instance_id", "time"]], 284 names=feature_matrix.index.names)) 285 AttributeError: type object 'MultiIndex' has no attribute 'from_frame'