I'd like to make a new column in dataframe df that will fill all rows with [np.nan]
df['new'] = [np.nan]
I get
ValueError: Length of values does not match length of index
If I try
test['new'] = np.nan
test['new'] = test['new'].astype('object')
test['new'] = [np.nan]
I get
ValueError: Length of values does not match length of index
I'd like to be sure that all rows are filled with a list containing nan
[np.nan]instead ofnp.nan? That's inefficient and highly inadvisable. Your series will becomeobjecttype (a sequence of pointers) rather thanfloat.