Given that, I have a dataframe as below:
import pandas as pd
import numpy as np
dict = {
"A": [[1,2,3,4],[3],[2,8,4],[5,8]]
}
dt = pd.DataFrame(dict)
I wish to have the Maximum and minimum of each row in column B. My favorite output is:
A B
0 [1, 2, 3, 4] [1,4]
1 [3] [3,3]
2 [2, 8, 4] [2,8]
3 [5, 8] [5,8]
What I already tried is the below code which does not work:
dt["B"] =[np.min(dt.A), np.max(dt.A)]