Reference#

fython package#

fython.fame_to_python module#

fame_to_csv(databases, frequency, date_from, date_to, search_string, path, decimals=10)#

Fetch data from Fame databases and write it to a CSV file.

Parameters:
  • databases (list) – List of Fame databases to access (with full path).

  • frequency (str) – Frequency of the data (‘a’, ‘q’, ‘m’).

  • date_from (str) – Start date for the data in Fame syntax (e.g., ‘2023:1’ for quarterly, ‘2023’ for annual).

  • date_to (str) – End date for the data in Fame syntax (e.g., ‘2024:4’ for quarterly, ‘2024’ for annual).

  • search_string (str) – Query string for fetching specific data. The search is not case sensitive, and “^” and “?” are wildcards (for exactly one and any number of characters, respectively)

  • path (str) – Path to the CSV file to be created.

  • decimals (int, optional) – Number of decimal places in the fetched data (default is 10).

Raises:

FileNotFoundError – If the specified path or its directory does not exist.

Return type:

None

Notes

The CSV file is created with the same name as the provided path with a .csv extension.

Examples

>>> fame_to_csv(['database1', 'database2'], 'q', '2023:1', '2024:4', 'search_query', '/path/to/output')
fame_to_pandas(databases, frequency, date_from, date_to, search_string, decimals=10, dtype=<class 'numpy.float64'>)#

Convert data from Fame databases to a Pandas DataFrame with PeriodIndex.

Parameters:
  • databases (list) – List of Fame databases to access (with full path).

  • frequency (str) – Frequency of the data (‘a’, ‘q’, ‘m’).

  • date_from (str) – Start date for the data in Fame syntax (e.g., ‘2023:1’ for quarterly, ‘2023’ for annual).

  • date_to (str) – End date for the data in Fame syntax (e.g., ‘2024:4’ for quarterly, ‘2024’ for annual).

  • search_string (str) – Query string for fetching specific data. The search is not case sensitive, and “^” and “?” are wildcards (for exactly one and any number of characters, respectively)

  • decimals (int, optional) – Number of decimal places in the fetched data (default is 10).

  • dtype (type, optional) – Type of TBD.

Returns:

DataFrame containing Fame data fetched based on the provided parameters. The index is a PeriodIndex with the specified frequency.

Return type:

pandas.DataFrame

Examples

>>> df = fame_to_pandas(['path/to/database1', 'path/to/database2'], 'q', '2023:1', '2024:4', 'your_search_query')