-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from jGaboardi/deprecate_by_cols
future warn for .by_col() methods
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
""" | ||
__author__ = "Serge Rey <[email protected]> " | ||
|
||
import warnings | ||
|
||
import numpy as np | ||
import scipy.stats as stats | ||
from libpysal import weights | ||
|
@@ -224,6 +226,13 @@ def by_col( | |
Technical details and derivations can be found in :cite:`cliff81`. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
return _univariate_handler( | ||
df, | ||
cols, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
""" | ||
__author__ = "Sergio J. Rey <[email protected]> , Luc Anselin <[email protected]>" | ||
|
||
import warnings | ||
|
||
import numpy as np | ||
import pandas as pd | ||
from scipy.stats import chi2, chi2_contingency | ||
|
@@ -288,6 +290,13 @@ def by_col( | |
dataframe with the relevant columns attached. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
if outvals is None: | ||
outvals = [] | ||
outvals.extend(["bb", "p_sim_bw", "p_sim_bb"]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
"Serge Rey <[email protected]" | ||
) | ||
|
||
import warnings | ||
from functools import reduce | ||
|
||
from libpysal.cg import ( | ||
|
@@ -653,6 +654,13 @@ def by_col(cls, df, e, b, inplace=False, **kwargs): | |
a copy of `df` containing the columns. Or, if `inplace`, this returns | ||
None, but implicitly adds columns to `df`. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
if not inplace: | ||
new = df.copy() | ||
cls.by_col(new, e, b, inplace=True, **kwargs) | ||
|
@@ -848,6 +856,13 @@ def by_col(cls, df, e, b, w=None, inplace=False, **kwargs): | |
a copy of `df` containing the columns. Or, if `inplace`, this returns | ||
None, but implicitly adds columns to `df`. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
if not inplace: | ||
new = df.copy() | ||
cls.by_col(new, e, b, w=w, inplace=True, **kwargs) | ||
|
@@ -1240,6 +1255,13 @@ def by_col(cls, df, e, b, w=None, s=None, **kwargs): | |
a copy of `df` containing the columns. Or, if `inplace`, this returns | ||
None, but implicitly adds columns to `df`. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
if s is None: | ||
raise ValueError("Standard population variable 's' must be supplied.") | ||
import pandas as pd | ||
|
@@ -1660,6 +1682,13 @@ def by_col(cls, df, e, b, x_grid, y_grid, geom_col="geometry", **kwargs): | |
coordinates of the grid cells and the rates associated with those grid | ||
cells. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
import pandas as pd | ||
|
||
# prep for application over multiple event/population pairs | ||
|
@@ -2123,6 +2152,12 @@ def by_col(cls, df, e, b, t=None, geom_col="geometry", inplace=False, **kwargs): | |
`df` is modified in place. | ||
""" | ||
|
||
msg = ( | ||
"The `.by_col()` methods are deprecated and will be " | ||
"removed in a future version of `esda`." | ||
) | ||
warnings.warn(msg, FutureWarning) | ||
|
||
if not inplace: | ||
new = df.copy() | ||
cls.by_col(new, e, b, t=t, geom_col=geom_col, inplace=True, **kwargs) | ||
|