ResourceCollection¶
- class xbrl_filings_api.ResourceCollection¶
Bases:
objectCollection of subresources of a
FilingSetobject.The subresources are all other
APIResourcesubclasses exceptFilingobjects.This object may be iterated over, it defines
len()as well as operatorin. It may not, however, be accessed with an indexer (e.g.object[index]) orreversed.This collection is a view to the non-
Filingresources of the parentFilingSet, backreferenced in attributefilingset.EntityandValidationMessageobjects, as subclasses ofAPIResource, have a custom__hash__()method and their hash is based on a tuple of strings'APIResource', class attributeTYPE, and objectapi_id. This means that equality checks (==) and related methods are based on this tuple. For example, when the actual entity object is not available, a fast way to check if an entity withapi_id'123'is included in the filing setfsis:('APIResource', Entity.TYPE, '123') in fs.entities
Methods
get_pandas_data([attr_names, ...])Get resources as data for
pandas.DataFrameconstructor.__hash__()Return hash(self).
__repr__()Return repr with
item_classandlen(self).__str__()Return str(self).
Attributes
List of available columns for resources of this type.
True if any resources of this type exist.
Reference to the parent
FilingSetobject.Type object of the items within.
- item_class: type[APIResource]¶
Type object of the items within.
- property exist: bool¶
True if any resources of this type exist.
This property is faster than
len(obj) != 0.
- get_pandas_data(attr_names=None, *, strip_timezone=True, date_as_datetime=True, include_urls=False)¶
Get resources as data for
pandas.DataFrameconstructor.For example, a new dataframe can be instantiated for entities as follows:
import pandas as pd df = pd.DataFrame(data=filingset.entities.get_pandas_data())
If parameter
attr_namesis not given, most data attributes will be extracted.- Parameters:
attr_names (iterable of str, optional) – Valid attribute names of resource object.
strip_timezone (bool, default True) – Strip timezone information (always UTC) from
datetimevalues.date_as_datetime (bool, default True) – Convert
datevalues to naivedatetimeto be converted topandas.datetime64by pandas.include_urls (bool, default False) – When parameter
attr_namesis not given, include attributes ending_url.
- Returns:
data – Column names are the same as the attributes for resource of this type.
- Return type:
dict of {str: list of DataAttributeType}
See also
FilingSet.get_pandas_dataFor
Filingresources.
- __contains__(elem)¶
Return True if ResourceCollection contains
elem.
- __iter__()¶
Iterate ResourceCollection.
- Return type:
- __repr__()¶
Return repr with
item_classandlen(self).- Return type: