This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: # What's the fastest way to convert a column of minutes to hours? | |
In [2]: import pandas as pd | |
In [3]: import numpy as np | |
In [4]: minutes = pd.Series(np.random.randint(0, 1440, size=(20000))) | |
In [5]: minutes.shape | |
Out[5]: (20000,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By Jake VanderPlas | |
# License: BSD-style | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def discrete_cmap(N, base_cmap=None): | |
"""Create an N-bin discrete colormap from the specified input map""" |