Sorry I'm new so if this has been covered share the link because I couldn't find it.
I have a csv that shows as the following in a text viewer...
TeamCode,Name,ConferenceCode
5,Akron,875
8,Alabama,911
9,UAB,24312
I was trying to import it into a dictionary with the following
import numpy as np
key_value = np.loadtxt('team.csv', delimiter=",",skiprows = 1, dtype = 'str')
for i in key_value:
print(i)
mydict = { k:[v, z] for k,v,z in key_value}
Which returns
["b'5'" "b'Akron'" "b'875'"]
["b'8'" "b'Alabama'" "b'911'"]
["b'9'" "b'UAB'" "b'24312'"]
I don't know why I am getting the b's. If there is a better way of doing this let me know, but I'm trying to create dictionary from the csv and thought this should work. Since I am getting the b's things aren't working as planned using the dictionary.
New edit... I appreciate all the help, however does anyone know why I'm getting the b? It appears when importing the numpy module I get it, everything else is okay. I'm running on a mac, no reason that would cause it right?