For years I've used Pandas on a daily basis and often (but not nearly as frequently) use Numpy. Most of the time I'll do something like:
import pandas as pd
import numpy as np
But [EDIT: prior to pandas 2.0] there is also the option of using Numpy directly from Pandas:
df['value'] = pd.np.where(df['date'] > '2020-01-01', 1, 0)
Does anyone know if either one of these options is significantly more performant than the other?
pandas.np
was removed in Pandas 2.0.0 and previously deprecated in Pandas 1.0.0:
<ipython-input-631-4160e33c868a>:1: FutureWarning: The pandas.np module is
deprecated and will be removed from pandas in a future version.
Import numpy directly instead
But for what it's worth, you can check that it was the same module in the source code.