Skip to content

Commit

Permalink
ENH: Do not warn on explicit prepend. Closes #217.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseabold committed Apr 10, 2012
1 parent 2534f1e commit a230bd5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions statsmodels/tools/tools.py
Expand Up @@ -286,9 +286,19 @@ def add_constant(data, prepend=False):
code.
'''
if not prepend:
import warnings
warnings.warn("The default of `prepend` will be changed to True in the "
"next release, use explicit prepend", FutureWarning)
import inspect
frame = inspect.currentframe().f_back
info = inspect.getframeinfo(frame)
try:
to_warn = '\n'.join(info.code_context)
except: # python 2.5 compatibility
to_warn = '\n'.join(info[3])
if to_warn:
import warnings
warnings.warn("The default of `prepend` will be changed to True "
"in 0.5.0, use explicit prepend",
FutureWarning)

if _is_using_pandas(data, None):
# work on a copy
return _pandas_add_constant(data.copy(), prepend)
Expand Down

0 comments on commit a230bd5

Please sign in to comment.