Is pandas.types.common deprecated or not?

51 views
Skip to first unread message

Skip Montanaro

unread,
Nov 13, 2018, 12:50:08 PM11/13/18
to Project Jupyter
I'm a novice Jupyter user (but long-time Python developer). I have a module which imports pandas.types.common to get at is_datetimelike. I get no complaints at a vanilla Python prompt. When that code is loaded into a running Jupyter notebook, I get a pink warning I've so far not been able to dismiss which basically says:

.../ipykernel_launcher.py:1: DeprecationWarning: pandas.types.common is deprecated ... yadda yadda yadda ...

It recommends that I use pandas.api.types instead. That's fine, but is_datetimelike isn't available there.

I'm happy to adapt to whatever is "correct", but this seems a bit inconsistent to me.

Version info:

Python 3.6.6
iykernel 4.8.2
ipython 6.4.0
jupyter 1.0.0
jupyter_core 4.4.0

I can't really update any of these (well, I could in my personal Conda environment, but not our production environments).

Is there a clean way around my pink warning dilemma?

Thanks,

Skip Montanaro

Roland Weber

unread,
Nov 14, 2018, 1:38:54 AM11/14/18
to Project Jupyter
You're dealing with two different versions of Pandas. Check the version and install location in each environment like this:

    import pandas
    print(pandas.__version__)
    print(pandas.__file__)

Before using the command prompt, are you activating the conda environment in which the kernel is installed? If not, then you're not using the same Pandas installation as the kernel.

If your module actually needs to support two different Pandas versions, try to import the utility function from the new location first, and use the old location if that fails. Have a look at "alternative 4" here:

Hope that helps,
  Roland

Skip Montanaro

unread,
Nov 14, 2018, 5:51:12 PM11/14/18
to Project Jupyter
Thanks, yes, they seem to be identical (0.23.1, same file). Maybe they weren't before, but I was fairly certain I started the notebook server from my regular conda environment. I'll double-check tomorrow.

I'm not really too concerned about the deprecation. I'm more concerned with the fact that the function I want to use seems not to be available from pandas.api.types, though that is the recommended replacement for pandas.types.common. For the moment, it appears I need to put up with the deprecation warnings.

Skip Montanaro

unread,
Nov 16, 2018, 10:06:47 AM11/16/18
to Project Jupyter
I'm going to just ignore this. At work I'm using Python 3.6.6, Pandas 0.23.1 and ipykernel 4.8.2. That combination yields the warning. At home I'm using 3.7, 0.23.4, and 5.1.0. That combination doesn't appear to warn. Perhaps the deprecation warning was itself an error and has been suppressed in the newer version of Pandas.
Reply all
Reply to author
Forward
0 new messages