BUG: `yaml.dump` throws AttributeError on dataframe – problem with `reduce`?
- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pandas.
- [ ] (optional) I have confirmed this bug exists on the master branch of pandas.

#### Please note

I have reported this problem for PyYAML as https://github.com/yaml/pyyaml/issues/541, but one of the maintainers says that this cannot be fixed on their side, but is caused by the way Pandas implements `reduce`.

#### Code Sample, a copy-pastable example

Code:

```python
import pandas as pd
import numpy as np
import yaml

x = pd.DataFrame({
    'a': np.array([1.0, 2.0])
})

yaml.dump(x)
```

Result:

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/__init__.py", line 290, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/__init__.py", line 278, in dump_all
    dumper.represent(data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 27, in represent
    node = self.represent_data(data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 52, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 342, in represent_object
    return self.represent_mapping(
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 52, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 346, in represent_object
    return self.represent_sequence(tag+function_name, args)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 92, in represent_sequence
    node_item = self.represent_data(item)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 286, in represent_tuple
    return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 92, in represent_sequence
    node_item = self.represent_data(item)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 52, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/home/ca/.conda/envs/std/lib/python3.8/site-packages/yaml/representer.py", line 331, in represent_object
    if function.__name__ == '__newobj__':
AttributeError: 'functools.partial' object has no attribute '__name__'
```

Python 3.8.10 | packaged by conda-forge | (default, May 11 2021, 07:01:05)
PyYAML 5.4.1
Pandas 1.3.1
NumPy 1.21.1

#### Problem description

This prevents dataframes from being saved as YAML.

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit           : c7f7443c1bad8262358114d5e88cd9c8a308e8aa
python           : 3.8.10.final.0
python-bits      : 64
OS               : Linux
OS-release       : 4.19.0-17-amd64
Version          : #1 SMP Debian 4.19.194-3 (2021-07-18)
machine          : x86_64
processor        : 
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.3.1
numpy            : 1.21.1
pytz             : 2021.1
dateutil         : 2.8.2
pip              : 21.2.1
setuptools       : 49.6.0.post20210108
Cython           : None
pytest           : None
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 3.0.1
IPython          : 7.25.0
pandas_datareader: None
bs4              : None
bottleneck       : None
fsspec           : 2021.07.0
fastparquet      : None
gcsfs            : None
matplotlib       : None
numexpr          : None
odfpy            : None
openpyxl         : 3.0.7
pandas_gbq       : None
pyarrow          : 5.0.0
pyxlsb           : None
s3fs             : None
scipy            : 1.7.0
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : 0.19.0
xlrd             : None
xlwt             : None
numba            : 0.53.1


</details>
