skorch-dev / skorch

A scikit-learn compatible neural network library that wraps PyTorch
BSD 3-Clause "New" or "Revised" License
5.69k stars 384 forks source link

FIX: Make pd import local in DataFrameTransformer #1017

Closed BenjaminBossan closed 9 months ago

BenjaminBossan commented 10 months ago

DataFrameTransformer requires pandas but we don't want to have a dependency on pandas in skorch. Therefore, the pandas import should be local.

Back when I wrote this class, I thought it would be sufficient to import pandas at a class level, but that is incorrect. Now, pandas is important inside the method bodies.

For most skorch users, this should make no difference. But it will allow skorch users who use something from helpers.py to avoid having to install pandas.