Skip to content

repr of Periods in a Series is broken #10971

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

With latest master:

In [1]: from pandas import *

In [7]: p = period_range('2013',periods=10)

In [8]: p
Out[8]:
PeriodIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04',
             '2013-01-05', '2013-01-06', '2013-01-07', '2013-01-08',
             '2013-01-09', '2013-01-10'],
            dtype='int64', freq='D')

In [10]: Series(p)
Out[10]: -----------------------------------------------------------------------
----
AttributeError                            Traceback (most recent call last)
C:\Anaconda\envs\devel\lib\site-packages\IPython\core\formatters.pyc in __call__
(self, obj)
    693                 type_pprinters=self.type_printers,
    694                 deferred_pprinters=self.deferred_printers)
--> 695             printer.pretty(obj)
    696             printer.flush()
    697             return stream.getvalue()
...

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\format.pyc in _format_strings(s
elf)
   2107
   2108     def _format_strings(self):
-> 2109         values = np.array(self.values.to_native_types(), dtype=object)
   2110         formatter = self.formatter or (lambda x: '%s' % x)
   2111         fmt_values = [formatter(x) for x in values]

AttributeError: 'numpy.ndarray' object has no attribute 'to_native_types'

cc @sinhrks (I was trying to fix the stacklevel for the FutureWarnings, but saw this error, possibly related to your recent Period work?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Output-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions