This turned out to be non-trivial for me so I wanted to check if others have a simple solution for this:
Suppose I have an arbitrary number (say 3) of pd.Series
: which look like:
first = pd.Series(range(5))
second = pd.Series(range(7))
third = pd.Series(range(6))
I'd like to make them all of the same length (7 -- which is the largest length) and pad the shorter ones with np.nan
s either at the top (optionally at the bottom) so that first looks like:
nan
nan
0
1
2
3
4
and so on.