Repository: holoviz/holoviews

Issue:
period indexed data frame causes time axis range to be incorrect
#### ALL software version info
hvplot.__version__
'0.5.2'
#### Description of expected behavior and the observed behavior
The code below causes time axis to be in the microseconds range whereas the data frame is in the year range.  
One can manually zoom out and see the data plotted so it is just an issue of calculating the range of the time axis correctly
#### Complete, minimal, self-contained example code that reproduces the issue

```
import pandas as pd
df=pd.DataFrame(data=range(13),index=pd.period_range('1990','1991',freq='M'))
df.hvplot()
```
#### Screenshots or screencasts of the bug in action
![bokeh_plot_time_axis](https://user-images.githubusercontent.com/11561317/84218948-5cf22700-aa84-11ea-98df-7b2b45913e32.png)



Discussion:
@philippjfr has confirmed that this is still an issue on master (0.6.0).
@jlstevens @philippjfr  Any progress on this? matplotlib deals with it fine and its causing issues in adoption of hvplot.
@maximlt might be nice to address this one before release.
Transferring this to Holoviews as the bug lies there:

https://github.com/holoviz/holoviews/blob/8b2ee78b9bbe30bbc1f8fb39a7e48eda7e981dc9/holoviews/core/data/pandas.py#L164

where `PeriodIndex` kind is an object and therefore will not calculate the correct range

![image](https://user-images.githubusercontent.com/19758978/185100402-87495da7-4e13-4f73-abae-e61529d56e62.png)

Resolving patch:
diff --git a/holoviews/core/data/pandas.py b/holoviews/core/data/pandas.py
--- a/holoviews/core/data/pandas.py
+++ b/holoviews/core/data/pandas.py
@@ -1,8 +1,3 @@
-try:
-    import itertools.izip as zip
-except ImportError:
-    pass
-
 import numpy as np
 import pandas as pd
 
diff --git a/holoviews/core/util.py b/holoviews/core/util.py
--- a/holoviews/core/util.py
+++ b/holoviews/core/util.py
@@ -922,7 +922,10 @@ def max_range(ranges, combined=True):
                           for r in values for v in r):
                 converted = []
                 for l, h in values:
-                    if isinstance(l, datetime_types) and isinstance(h, datetime_types):
+                    if isinstance(l, pd.Period) and isinstance(h, pd.Period):
+                        l = l.to_timestamp().to_datetime64()
+                        h = h.to_timestamp().to_datetime64()
+                    elif isinstance(l, datetime_types) and isinstance(h, datetime_types):
                         l, h = (pd.Timestamp(l).to_datetime64(),
                                 pd.Timestamp(h).to_datetime64())
                     converted.append((l, h))


Test patch:
diff --git a/holoviews/tests/core/test_utils.py b/holoviews/tests/core/test_utils.py
--- a/holoviews/tests/core/test_utils.py
+++ b/holoviews/tests/core/test_utils.py
@@ -332,6 +332,10 @@ def test_max_range2(self):
         self.assertTrue(math.isnan(lower))
         self.assertTrue(math.isnan(upper))
 
+    def test_max_range3(self):
+        periods = [(pd.Period("1990", freq="M"), pd.Period("1991", freq="M"))]
+        expected = (np.datetime64("1990", 'ns'), np.datetime64("1991", 'ns'))
+        self.assertEqual(max_range(periods), expected)
 
 
 class TestWrapTupleStreams(unittest.TestCase):