Repository: tqdm/tqdm (Python)

Issue:
progress_apply bug: TypeError: unhashable type
- [x] I have marked all applicable categories:
    + [x] exception-raising bug
    + [ ] visual output bug
    + [ ] documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand [StackOverflow#tqdm] is more appropriate)
    + [ ] new feature request
- [x] I have visited the [source website], and in particular
  read the [known issues]
- [x] I have searched through the [issue tracker] for duplicates
- [x] I have mentioned version numbers, operating system and
  environment, where applicable:
  ```python
  import tqdm, sys
  print(tqdm.__version__, sys.version, sys.platform)
  ```

  [source website]: https://github.com/tqdm/tqdm/
  [known issues]: https://github.com/tqdm/tqdm/#faq-and-known-issues
  [issue tracker]: https://github.com/tqdm/tqdm/issues?q=
  [StackOverflow#tqdm]: https://stackoverflow.com/questions/tagged/tqdm


tqdm: 4.40.1
pandas: 0.25.3
python: 3.7

Code to replicate: https://gist.github.com/matthew-z/1e90517b34ed0ad67a47e9ad5a9b94e0
```python
import pandas
import tqdm


df = pandas.DataFrame({
    "title":["abc", "bcd"]
})


l = []
tqdm.tqdm.pandas(desc="Processing")
df["title"].progress_apply(l.extend)

```


Error Message:
```

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-9d87c7bad499> in <module>
      1 l = []
      2 tqdm.tqdm.pandas(desc="Processing")
----> 3 df["title"].progress_apply(l.extend)

~/.anaconda3/envs/pytorch/lib/python3.7/site-packages/tqdm/std.py in inner(df, func, *args, **kwargs)
    733                         fp_write=getattr(t.fp, 'write', sys.stderr.write))
    734 
--> 735                 func = df._is_builtin_func(func)
    736 
    737                 # Define bar updating wrapper

~/.anaconda3/envs/pytorch/lib/python3.7/site-packages/pandas/core/base.py in _is_builtin_func(self, arg)
    664         otherwise return the arg
    665         """
--> 666         return self._builtin_table.get(arg, arg)
    667 
    668 

TypeError: unhashable type: 'list'
```


progress_apply bug: TypeError: unhashable type
- [x] I have marked all applicable categories:
    + [x] exception-raising bug
    + [ ] visual output bug
    + [ ] documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand [StackOverflow#tqdm] is more appropriate)
    + [ ] new feature request
- [x] I have visited the [source website], and in particular
  read the [known issues]
- [x] I have searched through the [issue tracker] for duplicates
- [x] I have mentioned version numbers, operating system and
  environment, where applicable:
  ```python
  import tqdm, sys
  print(tqdm.__version__, sys.version, sys.platform)
  ```

  [source website]: https://github.com/tqdm/tqdm/
  [known issues]: https://github.com/tqdm/tqdm/#faq-and-known-issues
  [issue tracker]: https://github.com/tqdm/tqdm/issues?q=
  [StackOverflow#tqdm]: https://stackoverflow.com/questions/tagged/tqdm


tqdm: 4.40.1
pandas: 0.25.3
python: 3.7

Code to replicate: https://gist.github.com/matthew-z/1e90517b34ed0ad67a47e9ad5a9b94e0
```python
import pandas
import tqdm


df = pandas.DataFrame({
    "title":["abc", "bcd"]
})


l = []
tqdm.tqdm.pandas(desc="Processing")
df["title"].progress_apply(l.extend)

```


Error Message:
```

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-9d87c7bad499> in <module>
      1 l = []
      2 tqdm.tqdm.pandas(desc="Processing")
----> 3 df["title"].progress_apply(l.extend)

~/.anaconda3/envs/pytorch/lib/python3.7/site-packages/tqdm/std.py in inner(df, func, *args, **kwargs)
    733                         fp_write=getattr(t.fp, 'write', sys.stderr.write))
    734 
--> 735                 func = df._is_builtin_func(func)
    736 
    737                 # Define bar updating wrapper

~/.anaconda3/envs/pytorch/lib/python3.7/site-packages/pandas/core/base.py in _is_builtin_func(self, arg)
    664         otherwise return the arg
    665         """
--> 666         return self._builtin_table.get(arg, arg)
    667 
    668 

TypeError: unhashable type: 'list'
```




Hints:
Having this bug too, with `tqdm==4.40.0` and `pandas==0.25.3`:

```
TypeError: ('expected string or bytes-like object', 'occurred at index content.message')
```
Will fix in a few hours
Having this bug too, with `tqdm==4.40.0` and `pandas==0.25.3`:

```
TypeError: ('expected string or bytes-like object', 'occurred at index content.message')
```
Will fix in a few hours

Patch:
diff --git a/tqdm/std.py b/tqdm/std.py
--- a/tqdm/std.py
+++ b/tqdm/std.py
@@ -732,7 +732,10 @@ def inner(df, func, *args, **kwargs):
                         " Use keyword arguments instead.",
                         fp_write=getattr(t.fp, 'write', sys.stderr.write))
 
-                func = df._is_builtin_func(func)
+                try:
+                    func = df._is_builtin_func(func)
+                except TypeError:
+                    pass
 
                 # Define bar updating wrapper
                 def wrapper(*args, **kwargs):


Test patch:
diff --git a/tqdm/tests/tests_pandas.py b/tqdm/tests/tests_pandas.py
--- a/tqdm/tests/tests_pandas.py
+++ b/tqdm/tests/tests_pandas.py
@@ -103,6 +103,11 @@ def task_func(x):
         res2 = df.applymap(task_func)
         assert res1.equals(res2)
 
+        # apply unhashable
+        res1 = []
+        df.progress_apply(res1.extend)
+        assert len(res1) == df.size
+
         # apply
         for axis in [0, 1, 'index', 'columns']:
             res3 = df.progress_apply(task_func, axis=axis)