jeudi 29 octobre 2020

Python – Break a string which is derived from pasting columns from excel to a text widget

When I am pasting two columns from excel (one with identifiers and one with values/numbers) into an ipy.widgets text box the output strings looks like:

'US78378X1072\t 0.500 EU0009658145\t 0.055 GB0001383545\t 0.445 '

I want to automatically break this type of string to two variables such as the below or create a dictionary. Is this possible?

b = ['US78378X1072','EU0009658145','GB0001383545'] c = np.array([0.500,0.055,0.445])

d = {'US78378X1072':0.500, 'EU0009658145': 0.055,'GB0001383545':0.445}

Aucun commentaire:

Enregistrer un commentaire