2

EDIT 6/20/18:

As pointed out by @aydow, this is similar to this: How to suppress Pandas Future warning ?

The solution from that page did get rid of the warning for me:

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

However, there is no discussion of why (once I run pd.date_range) I get the warning for every command I enter into the console.

/end edit 6/20/18

First post, so my apologies if I mess anything up or leave out any critical information. I'm also fairly new to python, so its very possible that I'm making a stupid mistake somewhere. However, I can't find any info on this problem.

I'm calling the warning "sticky" for lack of better vocabulary on my part - once I get the warning once (it shows up after running pandas.date_range), I get the same warning pretty much regardless of what I enter into the python console. Details of what I'm trying to do and the results are below.
Thanks-in-advance for any help,

-Jeremy

Task:

Given a start year, a number of bins, and a timestep, I'm trying to create a series of timestamps using the pandas date_range function. Sample code:

import pandas as pd
NumBins = 10
timestep=3
startYr = 2018
BinList = 
pd.date_range(start='1/1/'+str(startYr),periods=NumBins,freq=str(timestep)+'min')

While this does result in the expected output (10 timestamps at 3-minute intervals starting at midnight on Jan 1, 2018), I get the following warning message:

C:\Users\mattje\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\widgets\variableexplorer\utils.py:414: FutureWarning: 'summary' is deprecated and will be removed in a future version.
  display = value.summary()

QUESTION:

Why does this warning message start showing up after I've run the date_range function regardless of what variable I try to inspect?

For example, if I run the first 4 lines of code and then enter 'timestep' into the console I get the following, I get the following (note the lack of warning after the output):

import pandas as pd
NumBins = 10
timestep=3
startYr = 2018

timestep
Out[2]: 3

After I run the

pd.date_range(start='1/1/'+str(startYr),periods=NumBins,freq=str(timestep)+'min')

line, I get the following when I enter 'timestep' into the console:

timestep
Out[4]: 3C:\Users\mattje\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\widgets\variableexplorer\utils.py:414: FutureWarning: 'summary' is deprecated and will be removed in a future version.
  display = value.summary()

If I make a new variable, I get:

test = 5
C:\Users\mattje\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\widgets\variableexplorer\utils.py:414: FutureWarning: 'summary' is deprecated and will be removed in a future version.
  display = value.summary()

If I import numpy I get:

import numpy as np
C:\Users\mattje\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\widgets\variableexplorer\utils.py:414: FutureWarning: 'summary' is deprecated and will be removed in a future version.
  display = value.summary()

OTHER INFO

  1. Closing the console and opening a new one resets the warning and I don't get it until I run the pd.date_range function again
  2. The warning does not seem to affect operation; I get the outputs and results I'm expecting. It's just weird and annoying.
  3. I'm using Anaconda Navigator 1.8.7 and have recently (in the last week) used conda to update all packages
  4. I'm using spyder 3.2.8 and python 3.6
Jeremy Matt
  • 647
  • 1
  • 7
  • 10
  • I tried your code on idle and spyder it didn't give me the warning – U13-Forward Jun 19 '18 at 23:59
  • 1
    Possible duplicate of [How to suppress Pandas Future warning ?](https://stackoverflow.com/questions/15777951/how-to-suppress-pandas-future-warning) – aydow Jun 20 '18 at 00:01
  • 1
    The code is not generated by your code. It is generated by Spyder. – DYZ Jun 20 '18 at 00:03
  • The deprecation warning was added in 0.23.0 as part of [#18217](https://github.com/pandas-dev/pandas/issues/18217). Not sure why Spyder (or Jupyter/IPython) is calling it, though. As noted in the deprecation issue, this is an undocumented and useless function… – abarnert Jun 20 '18 at 00:06
  • Is 3.2.8 the current Spyder? (The GitHub repo is for 4.0.0, which isn't out yet, and I can't find release notes anywhere on the new website…) – abarnert Jun 20 '18 at 00:08
  • @abarnert Spyder's 'check for update' option says that it is up to date. – Jeremy Matt Jun 20 '18 at 14:19
  • @aydow Thanks for the link, the warning suppression did get rid of the warning for me. That said, I'm not sure it's exactly a duplicate; the issue described there seems to be that the warning shows up only once when pandas is loaded. The warning I'm getting only shows up once I run pd.date_range and then continues to be generated after every command I run. – Jeremy Matt Jun 20 '18 at 14:23
  • the same error happening for me. Spyder 3.2.6, pandas 23.4. – clg4 Aug 26 '18 at 07:16

1 Answers1

6

Try the following:

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Kermit the Frog
  • 146
  • 2
  • 7