One problem is this:
c_(list1, list2, list3)
c_ is a quirky object that is used by indexing it instead of calling it. When you call it, you get the error mentioned in the comments:
In [42]: c_(list1, list2, list3)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-42-8fcbef857684> in <module>()
----> 1 c_(list1, list2, list3)
TypeError: 'CClass' object is not callable
Instead, use square brackets, so you are indexing:
In [44]: c_[list1, list2, list3]
Out[44]:
array([['10', '15', 'foo'],
['20', '25', 'bar'],
['30', '35', 'baz']],
dtype='|S3')
Note that it creates an array with dtype '|S3'. That is, all the elements in the array have been converted to strings. To save this with savetxt, use fmt='%s, %s, %s':
In [45]: savetxt('result.csv', c_[list1, list2, list3], fmt='%s, %s, %s')
In [46]: !cat result.csv
10, 15, foo
20, 25, bar
30, 35, baz
Also, instead of c_[list1, list2, list3], you could use zip(list1, list2, list3). Then the savetxt function will handle converting that argument to an array.
In [57]: list1 = [100000, 200000, 300000]
In [58]: savetxt('result.csv', zip(list1, list2, list3), fmt='%s, %s, %s')
In [59]: !cat result.csv
100000, 15, foo
200000, 25, bar
300000, 35, baz
Apparently c_ doesn't do a good job figuring out the appropriate lengths of the strings:
In [60]: c_[list1, list2, list3]
Out[60]:
array([['100', '15', 'foo'],
['200', '25', 'bar'],
['300', '35', 'baz']],
dtype='|S3')
By the way, your data is not already in a numpy array, so I don't think you gain much by using savetxt instead of the standard library csv. For example,
In [61]: import csv
In [62]: with open('result.csv', 'w') as f:
....: wrtr = csv.writer(f)
....: wrtr.writerows(zip(list1, list2, list3))
....:
In [63]: !cat result.csv
100000,15,foo
200000,25,bar
300000,35,baz
fmtstring tries to format them all as integers.'CClass' object is not callablec_does something like this: stackoverflow.com/questions/18601001/… docs.scipy.org/doc/numpy/reference/generated/numpy.c_.htmlcsvmodule? E.g.f = open('result.csv', 'w'); wrtr = csv.writer(f); wrtr.writerows(zip(list1, list2, list3)); f.close()