def retrieve_sam(name=None, path=None):
if name is not None:<EOL><INDENT>name = name.lower()<EOL>data_path = os.path.join(<EOL>os.path.dirname(os.path.abspath(__file__)), '<STR_LIT:data>')<EOL>if name == '<STR_LIT>':<EOL><INDENT>csvdata = os.path.join(<EOL>data_path, '<STR_LIT>')<EOL><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>csvdata = os.path.join(<EOL>data_path, '<STR_LIT>')<EOL><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>csvdata = os.path.join(data_path, '<STR_LIT>')<EOL><DEDENT>elif name in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>csvdata = os.path.join(<EOL>data_path, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(name))<EOL><DEDENT><DEDENT>elif path is not None:<EOL><INDENT>if path.startswith('<STR_LIT:http>'):<EOL><INDENT>response = urlopen(path)<EOL>csvdata = io.StringIO(response.read().decode(errors='<STR_LIT:ignore>'))<EOL><DEDENT>else:<EOL><INDENT>csvdata = path<EOL><DEDENT><DEDENT>elif name is None and path is None:<EOL><INDENT>try:<EOL><INDENT>import Tkinter as tkinter<EOL>from tkFileDialog import askopenfilename<EOL><DEDENT>except ImportError:<EOL><INDENT>import tkinter<EOL>from tkinter.filedialog import askopenfilename<EOL><DEDENT>tkinter.Tk().withdraw()<EOL>csvdata = askopenfilename()<EOL><DEDENT>return _parse_raw_sam_df(csvdata)<EOL>
Retrieve latest module and inverter info from a local file or the
SAM website.

This function will retrieve either:

    * CEC module database
    * Sandia Module database
    * CEC Inverter database
    * Anton Driesse Inverter database

and return it as a pandas DataFrame.

Parameters
----------
name : None or string, default None
    Name can be one of:

    * 'CECMod' - returns the CEC module database
    * 'CECInverter' - returns the CEC Inverter database
    * 'SandiaInverter' - returns the CEC Inverter database
      (CEC is only current inverter db available; tag kept for
      backwards compatibility)
    * 'SandiaMod' - returns the Sandia Module database
    * 'ADRInverter' - returns the ADR Inverter database

path : None or string, default None
    Path to the SAM file. May also be a URL.

If both name and path are None, a dialogue will open allowing the
user to select a file.

Returns
-------
samfile : DataFrame
    A DataFrame containing all the elements of the desired database.
    Each column represents a module or inverter, and a specific
    dataset can be retrieved by the command

Notes
-----
Files available at https://sam.nrel.gov/sites/default/files/

Examples
--------

>>> from pvlib import pvsystem
>>> invdb = pvsystem.retrieve_sam('CECInverter')
>>> inverter = invdb.AE_Solar_Energy__AE6_0__277V__277V__CEC_2012_
>>> inverter
Vac           277.000000
Paco         6000.000000
Pdco         6165.670000
Vdco          361.123000
Pso            36.792300
C0             -0.000002
C1             -0.000047
C2             -0.001861
C3              0.000721
Pnt             0.070000
Vdcmax        600.000000
Idcmax         32.000000
Mppt_low      200.000000
Mppt_high     500.000000
Name: AE_Solar_Energy__AE6_0__277V__277V__CEC_2012_, dtype: float64