{"id":27399,"library":"sklearndf","title":"sklearndf","description":"Data frame support and feature traceability for scikit-learn. Version 2.4.2 supports Python >=3.9, <4 and integrates with scikit-learn 1.6+. Release cadence is irregular, with recent minor versions every few months.","status":"active","version":"2.4.2","language":"python","source_language":"en","source_url":"https://github.com/BCG-X-Official/sklearndf","tags":["scikit-learn","dataframe","pandas","wrapper","pipeline","feature-tracking"],"install":[{"cmd":"pip install sklearndf","lang":"bash","label":"pip"},{"cmd":"conda install -c conda-forge -c bcg_gamma sklearndf","lang":"bash","label":"conda"}],"dependencies":[{"reason":"Required for DataFrame support","package":"pandas","optional":false},{"reason":"Core dependency for all estimators","package":"scikit-learn","optional":false},{"reason":"Used for internal utilities (>=2.1)","package":"pytools","optional":false}],"imports":[{"note":"EstimatorWrapperDF is in sklearndf.transformation, not top-level.","wrong":"from sklearndf import EstimatorWrapperDF","symbol":"EstimatorWrapperDF","correct":"from sklearndf.transformation import EstimatorWrapperDF"},{"note":"Do not import from sklearn directly; use sklearndf wrappers for DataFrame support.","wrong":"from sklearn import ...","symbol":"ClassifierDF","correct":"from sklearndf.classification import ClassifierDF"}],"quickstart":{"code":"from sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearndf.classification import ClassifierDF\n\ndata = load_iris(as_frame=True)\nX, y = data.data, data.target\n\nclf = ClassifierDF(DecisionTreeClassifier())\nclf.fit(X, y)\nprint(clf.feature_names_in_)\nprint(clf.predict(X[:5]))","lang":"python","description":"Creates a DecisionTreeClassifier with sklearndf wrapper, fits on iris DataFrame, and prints feature names and predictions."},"warnings":[{"fix":"Upgrade scikit-learn to >=1.6 (or 1.7 for full support).","message":"sklearndf 2.4.0 introduced scikit-learn 1.7 support. Older scikit-learn versions may break with 2.4.0+.","severity":"breaking","affected_versions":">=2.4.0"},{"fix":"Use only estimators that are known to return DataFrames (e.g., from sklearn.ensemble, sklearn.linear_model).","message":"Wrapper classes only accept scikit-learn estimators that support DataFrame output. Not all sklearn estimators do; check sklearn documentation.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `sklearndf.transformation.EstimatorWrapperDF` for estimators and `TransformerWrapperDF` for transformers.","message":"The pipeline module's `FitDataFrame` and `TransformDataFrame` are deprecated in favor of `EstimatorWrapperDF` and `TransformerWrapperDF`.","severity":"deprecated","affected_versions":">=2.3"},{"fix":"Replace `from sklearn.pipeline import Pipeline` with `from sklearndf.pipeline import PipelineDF`.","message":"When using with sklearn pipelines, use `sklearndf.pipeline.PipelineDF` instead of `sklearn.pipeline.Pipeline` to preserve DataFrame features.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from sklearndf.transformation import EstimatorWrapperDF","cause":"EstimatorWrapperDF is not in the top-level sklearndf module.","error":"ImportError: cannot import name 'EstimatorWrapperDF' from 'sklearndf'"},{"fix":"Ensure the estimator is fitted and scikit-learn version is >=1.0.","cause":"The estimator has not been fitted or does not expose feature_names_in_ (requires scikit-learn >=1.0).","error":"AttributeError: 'EstimatorWrapperDF' object has no attribute 'feature_names_in_'"},{"fix":"Place classifiers only at the end of the pipeline.","cause":"Using a classifier (ClassifierDF) inside a PipelineDF as an intermediate step instead of a transformer.","error":"TypeError: All intermediate steps should be transformers or implement fit_transform. 'ClassifierDF' doesn't"},{"fix":"Preprocess categorical features using OneHotEncoder or similar transformer before passing to estimator.","cause":"DataFrame contains non-numeric columns; sklearndf wrappers expect numeric input.","error":"ValueError: could not convert string to float: '...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}