<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 beapy
beapy is a Python package for obtaining data from the API of the Bureau of Economic Analysis.
Step1:  Methods for searching for data
getDataSetList()
Step2:  Datasets
There are 10 datasets available through the BEA API
Step3:  Example
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import urllib
import datetime
import matplotlib.pyplot as plt
%matplotlib inline
%load_ext autoreload
%autoreload 2
import beapy
apiKey = '3EDEAA66-4B2B-4926-83C9-FD2089747A5B'
bea = beapy.initialize(apiKey =apiKey)
Explanation: beapy
beapy is a Python package for obtaining data from the API of the Bureau of Economic Analysis.
End of explanation
# Get a list of the the data sets available from the BEA along with descriptions.
bea.getDataSetList()
# The getDataSet() method adds a dataSetList attiribute that is a list of the available datasets:
print(bea.dataSetList)
# Get a list of the the parameters for the NIPA dataset
bea.getParameterList('NIPA')
# The getParameterList() method adds a parameterList attiribute that is a list of the parameters of the chosen dataset.
print(bea.parameterList)
# Get a list of the values that the Frequency parameter in the NIPA dataset can take:
bea.getParameterValues('NIPA','Frequency')
# Download data from Table 1.1.5, TableID: 5. and plot
results  = bea.getNipa(TableID=5,Frequency='A',Year='X')
frame =results['data']
np.log(frame['Gross domestic product']).plot(grid=True,lw=3)
Explanation: Methods for searching for data
getDataSetList(): returns the available datasets.
getParameterList(dataSetName): returns the parameters of the specified dataset.
getParameterValues(dataSetName,ParameterName): returns the values accepted for a parameter of the specified dataset.
End of explanation
bea.getParameterValues('RegionalData','KeyCode')
bea.getParameterValues('RegionalData','GeoFips')
bea.getParameterValues('RegionalData','Year')
bea.getParameterValues('RegionalData','KeyCode')
Explanation: Datasets
There are 10 datasets available through the BEA API:
RegionalData (statistics by state, county, and MSA)
NIPA (National Income and Product Accounts)
~~NIUnderlyingDetail (National Income and Product Accounts)~~
Fixed Assets 
~~Direct Investment and Multinational Enterprises (MNEs)~~
Gross Domestic Product by Industry (GDPbyIndustry)
ITA (International Transactions)
IIP (International Investment Position)
Regional Income (detailed regional income and employment data sets)
RegionalProduct (detailed state and MSA product data sets)
beapy provides a separate method for accessing the data in each datset:
getRegionalData.(KeyCode=None,GeoFips='STATE',Year='ALL')
getNipa.(TableID=None,Frequency=None,Year='X',ShowMillions='N')
~~getNIUnderlyingDetail.()~~
getFixedAssets.()
~~getDirectInvestmentMNEs.()~~
getGrossDomesticProductByIndustry.()
getIta.()
getIip.()
getRegionalIncome.()
getRegionalProduct.()
Datasets and methods with a ~~strikethrough~~ are not currently accessible with the package.
Regional Data
getRegionalData.(KeyCode=None,GeoFips='STATE',Year='ALL')
Method for accessing data from the US at county, state, and regional levels.
End of explanation
# Get per capita personal income at the state level for all years.
result = bea.getRegionalData(KeyCode='PCPI_SI',GeoFips = 'STATE', Year = 'ALL')
frame = result['data']
# For each state including Washington, D.C., find the percentage difference between state pc income and US pc income.
for state in frame.columns:
    f = 100*(frame[state] - frame['United States'])/frame['United States']
    f.plot(grid=True)
Explanation: Example: Converging relative per capita incomes in the US
End of explanation
<END_TASK>