What you are trying to do should work with a list as well as array.
In [163]: a = [2323,34,12,-23,12,4,-33,-2,-1,11,-2]
...: b = [12,-23-1,-1,-3,-12]
...: c = np.array([23,45,3,13,-1992,5])
Collect the variables in a list:
In [164]: alist = [a,b,c]
In [165]: alist
Out[165]:
[[2323, 34, 12, -23, 12, 4, -33, -2, -1, 11, -2],
[12, -24, -1, -3, -12],
array([ 23, 45, 3, 13, -1992, 5])]
If I iterate like you do, and assign a new object to item, nothing changes in alist.
In [166]: for item in alist:
...: item = [1,2,3]
...:
In [167]: alist
Out[167]:
[[2323, 34, 12, -23, 12, 4, -33, -2, -1, 11, -2],
[12, -24, -1, -3, -12],
array([ 23, 45, 3, 13, -1992, 5])]
This is critical; when iterating through a list, you can't replace the iteration variable; otherwise you loose connection to the source.
Instead we modify the item, change it in-place.
In [168]: for item in alist:
...: for i,v in enumerate(item):
...: if v<0:
...: item[i] = 0
...:
...:
now the change appears in the list:
In [169]: alist
Out[169]:
[[2323, 34, 12, 0, 12, 4, 0, 0, 0, 11, 0],
[12, 0, 0, 0, 0],
array([23, 45, 3, 13, 0, 5])]
Verify that this has changed the original list/arrays:
In [170]: a
Out[170]: [2323, 34, 12, 0, 12, 4, 0, 0, 0, 11, 0]
Let's try something closer to your code:
In [171]: format_number = lambda n: n if n % 1 else int(n)
In [174]: formater = [2323,34,12,-23,12,4,-33,-2,-1,11,-2]
In [175]: new = list(map(lambda n: 0 if n < 0 else format_number(n), formater))
In [176]: new
Out[176]: [2323, 34, 12, 0, 12, 4, 0, 0, 0, 11, 0]
With the list(map()) I've created a new list. If want use this in a loop, as I did with item, I have to modify the original, e.g.
In [177]: formater[:] = new
In [178]: formater
Out[178]: [2323, 34, 12, 0, 12, 4, 0, 0, 0, 11, 0]
Applying this to the original variables:
In [179]: a = [2323,34,12,-23,12,4,-33,-2,-1,11,-2]
...: b = [12,-23-1,-1,-3,-12]
...: c = np.array([23,45,3,13,-1992,5])
In [180]: alist = [a,b,c]
In [181]: for item in alist:
...: item[:]=list(map(lambda n: 0 if n < 0 else format_number(n), item))
...:
In [182]: alist
Out[182]:
[[2323, 34, 12, 0, 12, 4, 0, 0, 0, 11, 0],
[12, 0, 0, 0, 0],
array([23, 45, 3, 13, 0, 5])]
print(formater)? instead offormater[count]= formater