0

I am using text = np.sort(np.genfromtxt('new1', delimiter= ' ',dtype=None,usecols=[1,2]))

and while printing text, the result I get is space separated values.

[(10014024, 'GAM.SW') (10014031, 'GAM.SW') (10014032, 'GAM.SW') (10014032, 'HAM.SW') (10014033, 'GAM.SW') (10014034, 'ZAM.SW')]

and not

[(10014024, 'GAM.SW'),(10014031, 'GAM.SW'),(10014032, 'GAM.SW'), (10014032, 'HAM.SW'),(10014033, 'GAM.SW'),(10014034, 'ZAM.SW')]

Because of this, I am getting some error in the further part of the program.How can I get the comma separated value?

  • That's just how numpy formats the arrays after print. Can you add the Traceback of the error completely in your question? – Mazdak Nov 26 '16 at 12:13
  • I have two files and I am comparing the values.
    on comparing (10014024, 'GAM.SW') (10014022, 'GAM.SW')`, i am getting -1
    – Vinodini Natrajan Nov 26 '16 at 12:19
  • Why on earth you think this problem is related to the commas between your items?? more importantly how you're comparing them together? and why you got -1? – Mazdak Nov 26 '16 at 12:24
  • `text` is a 1d structured array. How are you comparing the arrays? – hpaulj Nov 26 '16 at 14:08
  • Thanks guys. i got it.. the numpy nd array is of type void andso I was getting false comparisons. – Vinodini Natrajan Nov 26 '16 at 17:19

0 Answers0