简体   繁体   中英

pandas.date_range resulting in a repeated 'sticky' warning: “414: FutureWarning: 'summary' is deprecated and will be removed in a future version.”

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

Try the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM