DataframeΒΆ

Example

>>> from techminer2.database.metrics.trending_terms_by_year.user import DataFrame
>>> # Create, configure, and run the generator
>>> generator = (
...     DataFrame()
...     #
...     # FIELD:
...     .with_field("raw_author_keywords")
...     .having_terms_per_year(5)
...     .having_terms_in(None)
...     #
...     # DATABASE:
...     .where_root_directory_is("example/")
...     .where_database_is("main")
...     .where_record_years_range_is(None, None)
...     .where_record_citations_range_is(None, None)
...     .where_records_match(None)
... )
>>> df = generator.run()
>>> df.head()
year                      OCC  global_citations  year_q1  ...  rn    height  width
raw_author_keywords                                       ...
CONTENT_ANALYSIS 02:0181    2               181     2016  ...   2  0.177333      1
DIGITALIZATION 02:0181      2               181     2016  ...   3  0.177333      1
POPULAR_PRESS 02:0181       2               181     2016  ...   4  0.177333      1
TECHNOLOGY 02:0310          2               310     2016  ...   0  0.177333      2
BANKING 02:0291             2               291     2016  ...   1  0.177333      2

[5 rows x 8 columns]
>>> generator = (
...     DataFrame()
...     #
...     # FIELD:
...     .with_field("raw_author_keywords")
...     .having_terms_per_year(5)
...     .having_terms_in(
...         [
...             "FINTECH",
...             "BLOCKCHAIN",
...             "ARTIFICIAL_INTELLIGENCE",
...         ]
...     )
...     #
...     # DATABASE:
...     .where_root_directory_is("example/")
...     .where_database_is("main")
...     .where_record_years_range_is(None, None)
...     .where_record_citations_range_is(None, None)
...     .where_records_match(None)
... )
>>> df = generator.run()
>>> df.head()
year                             OCC  global_citations  ...  height  width
raw_author_keywords                                     ...
FINTECH 31:5168                   31              5168  ...    0.97      2
BLOCKCHAIN 02:0305                 2               305  ...    0.15      2
ARTIFICIAL_INTELLIGENCE 02:0327    2               327  ...    0.15      1

[3 rows x 8 columns]