Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Series no longer inherits from ndarray #1036

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

Comments

Projects
None yet
3 participants
@jseabold
Copy link
Member

commented Aug 12, 2013

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

pandas-dev/pandas#3482 (comment)

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Aug 12, 2013

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

@jreback

This comment has been minimized.

Copy link
Contributor

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 added a commit to jseabold/statsmodels that referenced this issue Aug 14, 2013

@jseabold

This comment has been minimized.

Copy link
Member Author

commented Aug 14, 2013

Thanks for the reminder. See #1042.

jseabold added a commit that referenced this issue Aug 14, 2013

Merge pull request #1042 from jseabold/series-not-ndarray
ENH: Pandas Series no longer inherits from ndarray. Closes #1036.

@jseabold jseabold closed this in ee818ae Aug 14, 2013

jseabold added a commit that referenced this issue Aug 14, 2013

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.

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

Merge pull request statsmodels#1042 from jseabold/series-not-ndarray
ENH: Pandas Series no longer inherits from ndarray. Closes statsmodels#1036.

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014

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 statsmodels#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 statsmodels#676
  BUG: return only yfitted if return_sorted is False closes statsmodels#922
  TST: Add regression test for statsmodels#1025.
  BUG: Check for 0 variance not unit. Closes statsmodels#1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes statsmodels#425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.

yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014

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 statsmodels#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 statsmodels#676
  BUG: return only yfitted if return_sorted is False closes statsmodels#922
  TST: Add regression test for statsmodels#1025.
  BUG: Check for 0 variance not unit. Closes statsmodels#1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes statsmodels#425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.

yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014

Merge remote-tracking branch 'origin/maintenance/0.5.x' into releases
* origin/maintenance/0.5.x: (1875 commits)
  Backport PR statsmodels#1200: BLD: do not install *.pyx *.c  MANIFEST.in
  Backport PR statsmodels#1157: Tst precision master
  Backport PR statsmodels#1149: BUG: Fix small data issues for ARIMA.
  Backport PR statsmodels#1125: REF/BUG: Some GLM cleanup. Used trimmed results in NegativeBinomial variance.
  Backport PR statsmodels#1124: BUG: Fix ARIMA prediction when fit without a trend.
  Backport PR statsmodels#1117: Update ex_arma2.py
  Backport PR statsmodels#1089: ENH: exp(poisson.logpmf()) for poisson better behaved.
  Backport PR statsmodels#1077: BUG: Allow 1d exog in ARMAX forecasting.
  Backport PR statsmodels#1075: BLD: Fix build issue on some versions of easy_install.
  Backport PR statsmodels#1071: Update setup.py to fix broken install on OSX
  Backport PR statsmodels#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 statsmodels#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.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.