Series no longer inherits from ndarray #1036

Closed
jseabold opened this Issue Aug 12, 2013 · 3 comments

Projects

None yet

3 participants

@jseabold
Member

Series no longer inherit from ndarrays. We should add this fix into the maintenance branch.

pandas-dev/pandas#3482 (comment)

@josef-pkt
Member

Sounds pretty good if this is the only change that we have to make.

@jreback
Contributor
jreback commented Aug 14, 2013

reproduced here

diff --git a/statsmodels/tools/tools.py b/statsmodels/tools/tools.py
index 85832d9..41c382b 100644
--- a/statsmodels/tools/tools.py
+++ b/statsmodels/tools/tools.py
@@ -231,13 +231,11 @@ def categorical(data, col=None, dictnames=False, drop=False, ):

 def _series_add_constant(data, prepend):
     const = np.ones_like(data)
-    const.name = 'const'
     if not prepend:
-        results = DataFrame([data, const]).T
-        results.columns = [data.name, 'const']
+        columns = [data.name,'const']
     else:
-        results = DataFrame([const, data]).T
-        results.columns = ['const', data.name]
+        columns = ['const',data.name]
+    results = DataFrame({ data.name : data, 'const' : const },columns=columns)
     return results

 def _dataframe_add_constant(data, prepend):
@jseabold
Member

Thanks for the reminder. See #1042.

@jseabold jseabold closed this in ee818ae Aug 14, 2013
@jseabold jseabold added a commit that referenced this issue Aug 14, 2013
@jseabold jseabold MAINT: Merge branch 'maintenance/0.5.x'. Merge to close issues.
* maintenance/0.5.x:
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
72528f4
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@jreback @jseabold jreback + jseabold ENH: Pandas Series no longer inherits from ndarray. Closes #1036. 885179e
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@jseabold jseabold MAINT: Merge branch 'maintenance/0.5.x'. Merge to close issues.
* maintenance/0.5.x:
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
5d36f4f
@yarikoptic yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014
@yarikoptic yarikoptic Merge tag 'v0.5.0' into debian
Version 0.5.0

* tag 'v0.5.0':
  DOC: Update release notes with maint branch changes.
  MAINT: Fix mailmap entry.
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
e9c3418
@yarikoptic yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014
@yarikoptic yarikoptic Merge remote-tracking branch 'origin/maintenance/0.5.x' into releases
* origin/maintenance/0.5.x: (1875 commits)
  Backport PR #1200: BLD: do not install *.pyx *.c  MANIFEST.in
  Backport PR #1157: Tst precision master
  Backport PR #1149: BUG: Fix small data issues for ARIMA.
  Backport PR #1125: REF/BUG: Some GLM cleanup. Used trimmed results in NegativeBinomial variance.
  Backport PR #1124: BUG: Fix ARIMA prediction when fit without a trend.
  Backport PR #1117: Update ex_arma2.py
  Backport PR #1089: ENH: exp(poisson.logpmf()) for poisson better behaved.
  Backport PR #1077: BUG: Allow 1d exog in ARMAX forecasting.
  Backport PR #1075: BLD: Fix build issue on some versions of easy_install.
  Backport PR #1071: Update setup.py to fix broken install on OSX
  Backport PR #1057: COMPAT: Fix py3 caching for get_rdatasets.
  BUG: fix predict (was refactoring victim)
  DOC: Update release notes with maint branch changes.
  MAINT: Fix mailmap entry.
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  ...
7ae7ee7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment