Creating a zero-filled pandas data frame

前端 未结 6 1780
情书的邮戳
情书的邮戳 2020-12-07 14:36

What is the best way to create a zero-filled pandas data frame of a given size?

I have used:

zero_data = np.zeros(shape=(len(data),len(feature_list)         


        
6条回答
  •  萌比男神i
    2020-12-07 14:57

    It's best to do this with numpy in my opinion

    import numpy as np
    import pandas as pd
    d = pd.DataFrame(np.zeros((N_rows, N_cols)))
    

提交回复
热议问题