I am trying to learn Python, however I am trying to import a dataset and cant get it work correctly...
This dataset contains 16 columns and 16 320 rows saved as txt file. I used the genfromtxt function as follow :
import numpy as np
dt=np.dtype([('name', np.str_, 16),('platform', np.str_, 16),('year', np.float_, (2,)),('genre', np.str_, 16),('publisher', np.str_, 16),('na_sales', np.float_, (2,)), ('eu_sales', np.float64, (2,)), ('jp_sales', np.float64, (2,)), ('other_sales', np.float64, (2,)), ('global_sales', np.float64, (2,)), ('critic_scores', np.float64, (2,)),('critic_count', np.float64, (2,)),('user_scores', np.float64, (2,)),('user_count', np.float64, (2,)),('developer', np.str_, 16),('rating', np.str_, 16)])
data=np.genfromtxt('D:\\data3.txt',delimiter=',',names=True,dtype=dt)
I get this error :
ValueError: size of tuple must match number of fields.
But my dt variable contains 16 types one for each column. I specify the datatype because otherwise the strings are replaced by nan.
Any help would be appreciated.