Skip to content

Instantly share code, notes, and snippets.

@RaulMedeiros
Last active August 31, 2020 19:27
Show Gist options
  • Save RaulMedeiros/4b05979fa764bde9acad34fe88e262a9 to your computer and use it in GitHub Desktop.
Save RaulMedeiros/4b05979fa764bde9acad34fe88e262a9 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame({"datetime": pd.to_datetime(np.random.randint(1582800000000000000, 1583500000000000000, 100, dtype=np.int64))})
fig, ax = plt.subplots()
df["datetime"].astype(np.int64).plot.hist(ax=ax)
labels = ax.get_xticks().tolist()
labels = pd.to_datetime(labels)
ax.set_xticklabels(labels, rotation=90)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment