BUG: GH12622 where pprint of Timestamp in nested structure fails
State: closed

- [x] closes #12622
- [x] tests added / passed
- [x] passes `git diff upstream/master | flake8 --diff`
- [x] whatsnew entry

I suspect this is a bug in Cython (I don't think `type(A).func` should be an `instancemethod`).  Not sure if we should use this workaround as we encounter issues in the wild, or do this for all the functions we can think of.


Labels:
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
updated

@wesm this work for you?

@kawochen let's put a test in for `Timedelta`. I think it has the same issue.

Looks like this should work. Cython esoterica!

thanks @kawochen 

@kawochen forgot to test for `Timedelta`, can you do a pr which adds?

Though does seem to work

```
In [7]: d = {'foo': 1, 'bar': [{'what': {'footttttttttttttttttttttttttttttttttt': pd.Timestamp('2011-01-01')}}] * 10, 'baz': [{'what': {'footttttttttttttttttttttttttttttttttt': pd.Timedelta('1 day 1 min')}}] * 10} 
In [8]: d
Out[8]: 
{'bar': [{'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}}],
 'baz': [{'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
  {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}}],
 'foo': 1}

In [9]: pprint.pprint(d)
{'bar': [{'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timestamp('2011-01-01 00:00:00')}}],
 'baz': [{'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}},
         {'what': {'footttttttttttttttttttttttttttttttttt': Timedelta('1 days 00:01:00')}}],
 'foo': 1}
```

No problem. Was going to update today :)