I have data in iPython DataFrame
like this
Date X Y Z
0 2015-11-30 20:23:05.556 281.764900
Matplotlib's date support pre-dates numpy's datetime support (and predates pandas
entirely). Therefore, it uses its own internal date convention.
To convert the "raw" number you're getting back to a datetime, use matplotlib.dates.num2date.
As an example similar to what you're doing:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
def on_click(event):
if event.inaxes is not None:
print mdates.num2date(event.xdata)
t = pd.date_range('2015-11-01', '2016-01-06', freq='H')
y = np.random.normal(0, 1, t.size).cumsum()
df = pd.DataFrame({'Y':y}, index=t)
fig, ax = plt.subplots()
df.plot(ax=ax)
fig.canvas.mpl_connect('button_press_event', on_click)
plt.show()