DataInfo#

class astropy.utils.data_info.DataInfo(bound=False)[源代码]#

基类:object

使用数据描述符添加 info 用于以统一和可移植的方式存储数据属性的属性。请注意 must 被称为 info 以便DataInfo()对象可以存储在 instance 使用 info 钥匙。因为owner_cls.x是一个描述符,所以Python不使用uyu dict__ ['x'] 通常情况下,描述符可以安全地存储在那里。多亏了https://nbviewer.jupyter.org/url/gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb对于这个对非散列类有效的技巧。

参数:
bound : bool布尔

如果为True,则这是类定义中的描述符属性,否则它是绑定到数据对象实例的DataInfo()对象。默认值为False。

属性摘要

attr_names 

attrs_from_parent 

description 

dtype 

format 

meta 

name 

unit 

方法总结

__call__([option, out])

将有关数据对象的摘要信息写入 out 文件句柄。

info_summary_attributes \(日期)

info_summary_stats \(日期)

属性文档

attr_names = {'description', 'dtype', 'format', 'meta', 'name', 'unit'}#
attrs_from_parent = {}#
description#
dtype#
format#
meta#
name#
unit#

方法文件

__call__(option='attributes', out='')[源代码]#

将有关数据对象的摘要信息写入 out 文件句柄。默认情况下,它通过系统标准输出.

这个 option 参数指定要包含的信息类型。它可以是字符串、函数或字符串或函数的列表。内置选项包括:

  • attributes: data object attributes like dtype and format

  • stats :基本统计:最小值、平均值和最大值

如果指定了一个函数,则将使用数据对象作为其单个参数来调用该函数。函数必须返回包含信息属性的OrderedDict。

如果提供了列表,那么将依次为每个选项附加信息属性。

参数:
option : strcallable()list 的 (strcallable() )PYTHON:STR,PYTHON:Callable(),PYTHON:LIST OF(PYTHON:STR或PYTHON:Callable())

信息选项,默认为“属性”。

out : file-like objectNonePYTHON:类似文件的对象,PYTHON:无

输出目的地,默认为系统标准输出. 如果没有,则返回带信息属性的OrderedDict

返回:
info : OrderedDict or NoneOrderedDict或Python:无

OrderedDict 如果输出==无其他无

实例

>>> from astropy.table import Column
>>> c = Column([1, 2], unit='m', dtype='int32')
>>> c.info()
dtype = int32
unit = m
class = Column
n_bad = 0
length = 2
>>> c.info(['attributes', 'stats'])
dtype = int32
unit = m
class = Column
mean = 1.5
std = 0.5
min = 1
max = 2
n_bad = 0
length = 2
static info_summary_attributes(dat)#
static info_summary_stats(dat)#