I want to initilise a pandas dataframe with 1613 rows. I want to define the column names by the list 'indicns_list' (which has 471 elements). I tried this:
con_meds3 = pd.DataFrame(np.nan, index=range(0,1613),columns=indicns_list)
But I'm getting this error:
ValueError: Shape of passed values is (1613, 471), indices imply (1613, 1)
help! :)
their is issue in the indicns_list
if below code does fine. try this
con_meds3 = pd.DataFrame(np.nan, index=range(0,1613),columns=[i for i in range(1613)])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.