I'm looking for code to add [0,0] arrays to the 'Mar' column if the shape is smaller than (3,)
Sample Dataframe visualized:
df:
account Jan Feb Mar
Jones LLC | 150 | 200 | [.332, .326], [.058, .138]
Alpha Co | 200 | 210 | [[.234, .246], [.234, .395], [.013, .592]]
Blue Inc | 50 | 90 | [[.084, .23], [.745, .923]]
Again: I'm looking for code to add [0,0] arrays to the 'Mar' column so that any row with shape smaller than (3,x) is modified, resulting in the following df
df:
account Jan Feb Mar
Jones LLC | 150 | 200 | [.332, .326], [.058, .138], [0, 0]
Alpha Co | 200 | 210 | [[.234, .246], [.234, .395],[.013, .592]
Blue Inc | 50 | 90 | [[.084, .23], [.745, .923], [0, 0]
Code to create sample dataframe:
Sample = [{'account': 'Jones LLC', 'Jan': 150, 'Feb': 200, 'Mar': [[.332, .326], [.058, .138]]},
{'account': 'Alpha Co', 'Jan': 200, 'Feb': 210, 'Mar': [[.234, .246], [.234, .395], [.013, .592]]},
{'account': 'Blue Inc', 'Jan': 50, 'Feb': 90, 'Mar': [[.084, .23], [.745, .923]]}]
df = pd.DataFrame(Sample)