diff --git a/ISLP/info.py b/ISLP/info.py deleted file mode 100644 index 870c1e9..0000000 --- a/ISLP/info.py +++ /dev/null @@ -1,83 +0,0 @@ -""" This file contains defines parameters for regreg that we use to fill -settings in setup.py, the regreg top-level docstring, and for building the docs. -In setup.py in particular, we exec this file, so it cannot import regreg -""" - -# regreg version information. An empty _version_extra corresponds to a -# full release. '.dev' as a _version_extra string means this is a development -# version -_version_major = 0 -_version_minor = 2 -_version_micro = 0 -_version_extra = '' - -# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" -__version__ = "%s.%s.%s%s" % (_version_major, - _version_minor, - _version_micro, - _version_extra) - -CLASSIFIERS = ["Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Scientific/Engineering"] - -description = 'Library for ISLP labs' - -# Note: this long_description is actually a copy/paste from the top-level -# README.txt, so that it shows up nicely on PyPI. So please remember to edit -# it only in one place and sync it correctly. -long_description = \ -""" -============ -Fixed lambda -============ - -This mini-package contains a module to perform -a fixed lambda test for the LASSO. -""" - -# versions -NUMPY_MIN_VERSION='1.7.1' -SCIPY_MIN_VERSION = '0.9' -PANDAS_MIN_VERSION = "0.20" -PANDAS_MAX_VERSION = "1.9" -SKLEARN_MIN_VERSION = '1.2' -STATSMODELS_MIN_VERSION = '0.13' -MATPLOTLIB_MIN_VERSION = '3.3.3' - -NAME = 'ISLP' -MAINTAINER = "Jonathan Taylor" -MAINTAINER_EMAIL = "" -DESCRIPTION = description -LONG_DESCRIPTION = long_description -URL = "http://github.org/intro-stat-learning/ISLP" -DOWNLOAD_URL = "" -LICENSE = "BSD license" -CLASSIFIERS = CLASSIFIERS -AUTHOR = "ISLP authors" -AUTHOR_EMAIL = "" -PLATFORMS = "OS Independent" -MAJOR = _version_major -MINOR = _version_minor -MICRO = _version_micro -ISRELEASE = _version_extra == '' -VERSION = __version__ -STATUS = 'alpha' -PROVIDES = [] -REQUIRES = ["numpy (>=%s)" % NUMPY_MIN_VERSION, - "scipy (>=%s)" % SCIPY_MIN_VERSION, - "statsmodels (>=%s)" % STATSMODELS_MIN_VERSION, - "pandas (>=%s)" % PANDAS_MIN_VERSION, - "pandas (<=%s)" % PANDAS_MAX_VERSION, - "sklearn (>=%s)" % SKLEARN_MIN_VERSION, - "lifelines", - "joblib", - "pygam", - "torch", - "torchmetrics", - "pytorch_lightning" - ] diff --git a/ISLP/models/model_spec.py b/ISLP/models/model_spec.py index 983a85d..ce09e01 100644 --- a/ISLP/models/model_spec.py +++ b/ISLP/models/model_spec.py @@ -632,7 +632,7 @@ def build_model(column_info, if len(dfs): if isinstance(X, (pd.Series, pd.DataFrame)): - df = pd.concat(dfs, axis=1) + df = pd.concat(dfs, axis='columns') df.index = X.index else: return np.column_stack(dfs).astype(float) @@ -645,10 +645,11 @@ def build_model(column_info, return zero # if we reach here, we will be returning a DataFrame - - for col in df.columns: - if df[col].dtype == bool: - df[col] = df[col].astype(float) + # make sure all columns are floats + + for i, _ in enumerate(df.columns): + if df.iloc[:,i].dtype == bool: + df.iloc[:,i] = df.iloc[:,i].astype(float) return df def derived_feature(variables, encoder=None, name=None, use_transform=True): diff --git a/pyproject.toml b/pyproject.toml index b94fdf7..e0359ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ISLP" -version = "0.3.21" +version = "0.3.22" dependencies = ["numpy>=1.7.1,<1.25", # max version for numba "scipy>=0.9", "pandas>=0.20,<=1.9", @@ -37,6 +37,7 @@ classifiers = ["Development Status :: 3 - Alpha", "Programming Language :: Python", "Topic :: Scientific/Engineering" ] + [project.urls] # Optional "Homepage" = "https://github.com/intro-stat-learning/ISLP" "Bug Reports" = "https://github.com/intro-stat-learning/ISLP/issues" @@ -44,6 +45,9 @@ classifiers = ["Development Status :: 3 - Alpha", "Say Thanks!" = "http://saythanks.io/to/example" "Source" = "https://github.com/pypa/sampleproject/" +[project.optional-dependencies] +doc = ['Sphinx>=3.0'] + [build-system] requires = ["setuptools>=42", "wheel", diff --git a/setup.cfg b/setup.cfg index 14d7ccd..4a6f58e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,3 +4,6 @@ style = pep440 versionfile_source = ISLP/_version.py tag_prefix = parentdir_prefix = ISLP- + +[metadata] +license_files = LICENSE.txt \ No newline at end of file diff --git a/setup.py b/setup.py index 688c9c0..bf51c2e 100755 --- a/setup.py +++ b/setup.py @@ -16,74 +16,18 @@ from setuptools import setup -# Get various parameters for this version, stored in ISLP/info.py - -class Bunch(object): - def __init__(self, vars): - for key, name in vars.items(): - if key.startswith('__'): - continue - self.__dict__[key] = name - -def read_vars_from(ver_file): - """ Read variables from Python text file - - Parameters - ---------- - ver_file : str - Filename of file to read - - Returns - ------- - info_vars : Bunch instance - Bunch object where variables read from `ver_file` appear as - attributes - """ - # Use exec for compabibility with Python 3 - ns = {} - with open(ver_file, 'rt') as fobj: - exec(fobj.read(), ns) - return Bunch(ns) - -info = read_vars_from(pjoin('ISLP', 'info.py')) - -# Try to preempt setuptools monkeypatching of Extension handling when Pyrex -# is missing. Otherwise the monkeypatched Extension will change .pyx -# filenames to .c filenames, and we probably don't have the .c files. -sys.path.insert(0, pjoin(dirname(__file__), 'fake_pyrex')) -# Set setuptools extra arguments -extra_setuptools_args = dict( - tests_require=['nose'], - test_suite='nose.collector', - zip_safe=False, - extras_require = dict( - doc=['Sphinx>=1.0'], - test=['nose>=0.10.1'])) # Define extensions EXTS = [] -cmdclass=versioneer.get_cmdclass() +cmdclass = versioneer.get_cmdclass() # get long_description long_description = open('README.md', 'rt', encoding='utf-8').read() def main(**extra_args): - setup(name=info.NAME, - maintainer=info.MAINTAINER, - maintainer_email=info.MAINTAINER_EMAIL, - description=info.DESCRIPTION, - url=info.URL, - download_url=info.DOWNLOAD_URL, - license=info.LICENSE, - classifiers=info.CLASSIFIERS, - author=info.AUTHOR, - author_email=info.AUTHOR_EMAIL, - platforms=info.PLATFORMS, - version=versioneer.get_version(), - requires=info.REQUIRES, - provides=info.PROVIDES, + setup(version=versioneer.get_version(), packages = ['ISLP', 'ISLP.models', 'ISLP.models', @@ -104,4 +48,4 @@ def main(**extra_args): #simple way to test what setup will do #python setup.py install --prefix=/tmp if __name__ == "__main__": - main(**extra_setuptools_args) + main()