T # rename the index column to be called 'Date' DataFrame ( rates ) # create a new variable 'rates_table' to hold the dataframe and transpose the table json () # create a Pandas dataframe from the 'rates' level of the responseĭf = pd. get ( "" ) # create new variable 'rates' for the response from the API Notice that the dates should be set in the YYYY-MM-DD format.ĭef get_exchange_rates ( input ): # connect to the API to get exchange rates for GBP during October 2020. The start_at and end_at parameters to set our time period as October 2020. The symbols parameter to specify that we want to see only the rates for GBP The history parameter to indicate that we are interested in historical rates To achieve this, we need to use the following parameters in the URL: In this project we are interested in extracting exchange rates to convert sales values that happened during October 2020 from Euro to GBP. All rates are quoted against Euro by default, but you can change the base currency, if needed, by using the base parameter. We can request the most recent exchange rates, rates for a particular day in the past, or for a set time period. The Foreign Exchange Rates API documentation is just one page outlining the different parameters we can use to build the request URL. Now let’s see how we can bring the exchange rates data directly into our Tableau Prep flow. In this format the data is stored in name (a field name in double quotes, e.g. In this project, the response comes in JSON format as displayed in the image below. Usually, the response comes in XML or JSON format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |