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

DEPR: Panel deprecated #15601

Closed
wants to merge 15 commits into from
Closed

DEPR: Panel deprecated #15601

wants to merge 15 commits into from

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Mar 7, 2017

closes #13563

going to be on top of #15677

Partially addresses #14565 (comment)

Note this is currently a FutureWarning mainly to fail the tests if I missed anything. Intention is to change to a DeprecationWarning.

@jreback jreback added Deprecate Functionality to remove in pandas Panel labels Mar 7, 2017
@jreback jreback added this to the 0.20.0 milestone Mar 7, 2017
@jreback
Copy link
Contributor Author

jreback commented Mar 7, 2017

@codecov-io
Copy link

codecov-io commented Mar 7, 2017

Codecov Report

Merging #15601 into master will decrease coverage by <.01%.
The diff coverage is 94.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15601      +/-   ##
==========================================
- Coverage   90.99%   90.99%   -0.01%     
==========================================
  Files         145      145              
  Lines       49521    49537      +16     
==========================================
+ Hits        45061    45074      +13     
- Misses       4460     4463       +3
Flag Coverage Δ
#multiple 88.75% <94.28%> (-0.01%) ⬇️
#single 40.58% <17.14%> (-0.04%) ⬇️
Impacted Files Coverage Δ
pandas/util/testing.py 80.88% <100%> (+0.03%) ⬆️
pandas/core/panel.py 97.23% <100%> (ø) ⬆️
pandas/core/window.py 96.22% <100%> (+0.04%) ⬆️
pandas/indexes/multi.py 96.7% <100%> (-0.01%) ⬇️
pandas/indexes/frozen.py 91.17% <66.66%> (-2.38%) ⬇️
pandas/core/indexing.py 94.01% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9e00d2...04104a7. Read the comment docs.


# if we have stored a NaN in the categories
# then strip it; in theory we could have BOTH
# -1s in the codes and nulls :<
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting rid of a deprecation warning that was being trapped :>

@@ -3406,10 +3416,12 @@ def create_axes(self, axes, obj, validate=True, nan_rep=None,
if existing_table is not None:
indexer = len(self.non_index_axes)
exist_axis = existing_table.non_index_axes[indexer][1]
if append_axis != exist_axis:
if not array_equivalent(np.array(append_axis),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@TomAugspurger
Copy link
Contributor

I'm a bit behind on the discussion here, but have we talked about how we'll handle things like rolling corr and cov?

In [17]: df = pd.DataFrame(np.random.randn(100, 2))

In [18]: df.rolling(12).corr()
Out[18]:
<class 'pandas.core.panel.Panel'>
Dimensions: 100 (items) x 2 (major_axis) x 2 (minor_axis)
Items axis: 0 to 99
Major_axis axis: 0 to 1
Minor_axis axis: 0 to 1

@jorisvandenbossche
Copy link
Member

That's a good point, I don't think we already discussed that.
One option would be to follow the recommendation given in the deprecation warning and use a MultiIndex (with some deprecation strategy in rolling corr itself of course). Directly calling to_frame on the result is not the desired result, but if we swap some axes:

In [18]: p = df.rolling(12).corr()

In [21]: p.swapaxes(0,1).to_frame(filter_observations=False)
Out[21]: 
                    0         1
major minor                    
0     0           NaN       NaN
      1           NaN       NaN
1     0           NaN       NaN
      1           NaN       NaN
2     0           NaN       NaN
      1           NaN       NaN
3     0           NaN       NaN
      1           NaN       NaN
4     0           NaN       NaN
      1           NaN       NaN
...               ...       ...
96    0      1.000000 -0.437443
      1     -0.437443  1.000000
97    0      1.000000 -0.481589
      1     -0.481589  1.000000
98    0      1.000000 -0.094523
      1     -0.094523  1.000000
99    0      1.000000 -0.145248
      1     -0.145248  1.000000

[200 rows x 2 columns]

@jreback
Copy link
Contributor Author

jreback commented Mar 8, 2017

well I would simply change this to return a MI DataFrame as @jorisvandenbossche shows. This solves the problem and just fixes it.

We could also just show a FutureWarning (a specific one that this is going to change to a MI DataFrame in the next version). But that just defers the change itself, and getting warning of the change really doesn't help your code in this case as you have a different object being returned.

any objections to simply changing it? (I will do this as a separate PR). Further I think we should actually name these axes (self, other), maybe (arg1, ``arg2)?

@delgadom delgadom mentioned this pull request Mar 11, 2017
4 tasks
jreback added a commit to jreback/pandas that referenced this pull request Mar 13, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 13, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 13, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 19, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 22, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 22, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 22, 2017
jreback added a commit to jreback/pandas that referenced this pull request Mar 22, 2017
@jreback jreback force-pushed the panel branch 3 times, most recently from fcbecda to e716b3a Compare March 23, 2017 12:58
@jreback
Copy link
Contributor Author

jreback commented Apr 7, 2017

@jorisvandenbossche all pushed

Here is the whatsnew example

In [1]:    df = pd.DataFrame(np.random.rand(100, 2),
   ...:                      columns=pd.Index(['A', 'B'], name='bar'),
   ...:                      index=pd.date_range('20160101',
   ...:                                          periods=100, freq='D', name='foo'))

In [2]: df.tail()
Out[2]: 
bar                A         B
foo                           
2016-04-05  0.603159  0.694132
2016-04-06  0.466162  0.577965
2016-04-07  0.970528  0.403820
2016-04-08  0.837619  0.583224
2016-04-09  0.039695  0.029523

In [3]: df.rolling(12).corr().tail()
Out[3]: 
bar                    A         B
foo        bar                    
2016-04-07 B    0.161726  1.000000
2016-04-08 A    1.000000  0.222413
           B    0.222413  1.000000
2016-04-09 A    1.000000  0.380243
           B    0.380243  1.000000

@shoyer
Copy link
Member

shoyer commented Apr 7, 2017

I haven't looked at the code in details, but the docs look great here -- thanks @jreback !

@jreback jreback closed this in c25fbde Apr 7, 2017
@jreback
Copy link
Contributor Author

jreback commented Apr 7, 2017

and bombs away. sad day :<

@wesm
Copy link
Member

wesm commented Apr 7, 2017

Perhaps we can think about panels again as a way to manage a collection of DataFrame objects in C++ once pandas 2.0 hits the shelves

@jreback
Copy link
Contributor Author

jreback commented Apr 7, 2017

yep. I think was of the biggest criticisms was the indexing (how the axes were named), and the fact that indexing was not the same as numpy.

gfyoung added a commit to forking-repos/pandas that referenced this pull request Sep 12, 2018
"values" is the law of the land.

xref pandas-devgh-14645.

Follow-up to pandas-devgh-15601.
gfyoung added a commit to forking-repos/pandas that referenced this pull request Sep 13, 2018
"values" is the law of the land. This usage
is internal, hence why we aren't going
through a deprecation cycle.

xref pandas-devgh-14645.

Follow-up to pandas-devgh-15601.
gfyoung added a commit to forking-repos/pandas that referenced this pull request Sep 13, 2018
"values" is the law of the land. This usage
is internal, hence why we aren't going
through a deprecation cycle.

xref pandas-devgh-14645.

Follow-up to pandas-devgh-15601.
gfyoung added a commit to forking-repos/pandas that referenced this pull request Sep 13, 2018
"values" is the law of the land. This usage
is internal, hence why we aren't going
through a deprecation cycle.

xref pandas-devgh-14645.

Follow-up to pandas-devgh-15601.
gfyoung added a commit to forking-repos/pandas that referenced this pull request Sep 14, 2018
"values" is the law of the land.

xref pandas-devgh-14645.

Follow-up to pandas-devgh-15601.
gfyoung added a commit that referenced this pull request Sep 15, 2018
"value" is the law of the land.

xref gh-14645.

Follow-up to gh-15601.
aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecation of Panel ?
6 participants