コード例 #1
0
ファイル: base.py プロジェクト: ygene2/pandas
    def __repr__(self) -> str:
        from pandas.io.formats.printing import format_object_summary

        # the short repr has no trailing newline, while the truncated
        # repr does. So we include a newline in our template, and strip
        # any trailing newlines from format_object_summary
        data = format_object_summary(
            self, self._formatter(), indent_for_name=False
        ).rstrip(", \n")
        class_name = f"<{type(self).__name__}>\n"
        return f"{class_name}{data}\nLength: {len(self)}, dtype: {self.dtype}"
コード例 #2
0
    def __repr__(self):
        from pandas.io.formats.printing import format_object_summary

        template = "{class_name}" "{data}\n" "Length: {length}, dtype: {dtype}"
        # the short repr has no trailing newline, while the truncated
        # repr does. So we include a newline in our template, and strip
        # any trailing newlines from format_object_summary
        data = format_object_summary(
            self, self._formatter(), indent_for_name=False
        ).rstrip(", \n")
        class_name = "<{}>\n".format(self.__class__.__name__)
        return template.format(
            class_name=class_name, data=data, length=len(self), dtype=self.dtype
        )
コード例 #3
0
ファイル: _mixins.py プロジェクト: zitorelova/pandas
    def __repr__(self) -> str:
        if self.ndim == 1:
            return super().__repr__()

        from pandas.io.formats.printing import format_object_summary

        # the short repr has no trailing newline, while the truncated
        # repr does. So we include a newline in our template, and strip
        # any trailing newlines from format_object_summary
        lines = [
            format_object_summary(x, self._formatter(),
                                  indent_for_name=False).rstrip(", \n")
            for x in self
        ]
        data = ",\n".join(lines)
        class_name = f"<{type(self).__name__}>"
        return f"{class_name}\n[\n{data}\n]\nShape: {self.shape}, dtype: {self.dtype}"
コード例 #4
0
    def __repr__(self) -> str:
        """
        String representation.
        """
        from pandas.io.formats.printing import format_object_summary

        template = "{class_name}{data}\nLength: {length}, dtype: {dtype}"
        data = format_object_summary(self,
                                     self._formatter(),
                                     indent_for_name=False,
                                     is_justify=False).rstrip(", \n")
        class_name = "<{}>\n".format(self.__class__.__name__)

        return template.format(class_name=class_name,
                               data=data,
                               length=len(self),
                               dtype=self.dtype)
コード例 #5
0
ファイル: base.py プロジェクト: sinhrks/pandas
    def __repr__(self):
        from pandas.io.formats.printing import format_object_summary

        template = (
            u'{class_name}'
            u'{data}\n'
            u'Length: {length}, dtype: {dtype}'
        )
        # the short repr has no trailing newline, while the truncated
        # repr does. So we include a newline in our template, and strip
        # any trailing newlines from format_object_summary
        data = format_object_summary(self, self._formatter(),
                                     indent_for_name=False).rstrip(', \n')
        class_name = u'<{}>\n'.format(self.__class__.__name__)
        return template.format(class_name=class_name, data=data,
                               length=len(self),
                               dtype=self.dtype)
コード例 #6
0
ファイル: integer.py プロジェクト: zhuomingliang/pandas
    def __repr__(self):
        """
        Return a string representation for this object.

        Invoked by unicode(df) in py2 only. Yields a Unicode String in both
        py2/py3.
        """
        klass = self.__class__.__name__
        data = format_object_summary(self, default_pprint, False)
        attrs = format_object_attrs(self)
        space = " "

        prepr = (u(",%s") % space).join(u("%s=%s") % (k, v) for k, v in attrs)

        res = u("%s(%s%s)") % (klass, data, prepr)

        return res
コード例 #7
0
ファイル: integer.py プロジェクト: bkandel/pandas
    def __repr__(self):
        """
        Return a string representation for this object.

        Invoked by unicode(df) in py2 only. Yields a Unicode String in both
        py2/py3.
        """
        klass = self.__class__.__name__
        data = format_object_summary(self, default_pprint, False)
        attrs = format_object_attrs(self)
        space = " "

        prepr = (u(",%s") %
                 space).join(u("%s=%s") % (k, v) for k, v in attrs)

        res = u("%s(%s%s)") % (klass, data, prepr)

        return res