wesm/pandas — Issue #465: DataFrame.applymap(func) issue when func returns tuple 
Author: lodagro
Created: 2011-12-09 11:13:43+00:00
State: open

```python
In [82]: def func_tuple(x):
....: return (x,x)
....:

In [83]: series = pandas.Series(['a', 'b', 'c', 'd'])

In [84]: df = pandas.DataFrame({'A': series})

In [85]: df
Out[85]:
A
0 a
1 b
2 c
3 d

In [86]: df.applymap(func_tuple)
Out[86]:
A
0 None
1 None
2 None
3 None
```

This works fine

```python
In [87]: map(func_tuple, series)
Out[87]: [('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd')]
```

Let`s try with a list:

```python
In [88]: def func_list(x):
....: return [x,x]

In [89]: df.applymap(func_list)
Out[89]:
A
0 ['a', 'a']
1 ['b', 'b']
2 ['c', 'c']
3 ['d', 'd']
```

Had a look at the pandas.DataFrame.applymap() code and this behavior is related to numpy.
I`m using numpy 1.5.1, i know that for other reason numpy 1.6.1 is preferred. Would more recent numpy version fix this?
I tried to install more recent version of numpy, but so far unsuccessful (various compilation errors).

```python
In [103]: np.frompyfunc(func_tuple, 1, 1)(series)
Out[103]:
0 NaN
1 NaN
2 NaN
3 NaN

In [104]: np.frompyfunc(func_list, 1, 1)(series)
Out[104]:
0 ['a', 'a']
1 ['b', 'b']
2 ['c', 'c']
3 ['d', 'd']
```