Answers.Body: <p>Here is the website of the creator of rdatasets I guess with the info you are looking for:</p>
  
  <p><a href="http://vincentarelbundock.github.io/Rdatasets/datasets.html" rel="nofollow noreferrer">http://vincentarelbundock.github.io/Rdatasets/datasets.html</a></p>
  
  <p>Here is a short look at it:</p>
  
  <pre><code>Package     Item    Title   Rows    Cols    n_binary    n_character     n_factor    n_logical   n_numeric   CSV     Doc
  boot    acme    Monthly Excess Returns  60  3   0   1   0   0   2   CSV     DOC
  boot    aids    Delay in AIDS Reporting in England and Wales    570     6   1   0   0   0   6   CSV     DOC
  boot    aircondit   Failures of Air-conditioning Equipment  12  1   0   0   0   0   1   CSV     DOC
  boot    aircondit7  Failures of Air-conditioning Equipment  24  1   0   0   0   0   1   CSV     DOC
  boot    amis    Car Speeding and Warning Signs  8437    4   1   0   0   0   4   CSV     DOC
  boot    aml     Remission Times for Acute Myelogenous Leukaemia     23  3   2   0   0   0   3   CSV     DOC 
  ...
  </code></pre>
  
  <p>I assume the Item column are the identifiers.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-20T14:15:13.033Z
Answers.Text: As stated above, that does not seem to work. Try for example 'rice'.
Answers.UserDisplayName: Soerendip
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-22T11:18:26.757Z
Answers.Text: Did you change the package parameter to DAAG for the dataset rice? Since it’s not in the package datasets according to the index site.
Answers.UserDisplayName: voiDnyx
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-20T10:08:24.933Z
Answers.LastActivityDate: 2019-12-20T10:08:24.933Z
Answers.UserDisplayName: voiDnyx
Answers.Body: <p>You can view all the available datasets at this URL <a href="https://github.com/vincentarelbundock/Rdatasets/blob/master/datasets.csv" rel="nofollow noreferrer">https://github.com/vincentarelbundock/Rdatasets/blob/master/datasets.csv</a></p>
  <p>The available ones in statsmodels are those with the tag <code>datasets</code> which looks like line 372 - 455.</p>
  <p>I didn't test them all, but everyone I tried from a small random sample seemed to work fine.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-19T17:34:33.033Z
Answers.LastActivityDate: 2021-01-19T17:34:33.033Z
Answers.UserDisplayName: andrewnc
Answers.Body: <p>Please, try this code to get all modules in datasets:</p>
  <pre><code>import statsmodels.api as sm
  import inspect
  
  def get_list_of_modules_in_datasets():
    # get list of strings for the objects in datasets
    list_str_in_datasets = sm.datasets.__all__
    print(list_str_in_datasets)
    # get list of objects in datasets
    list_objs_in_datasets = [eval('sm.datasets.' + dsstr) for dsstr in list_str_in_datasets]
    print(list_objs_in_datasets)
    # get list of modules in datasets
    list_modules_in_datasets = []
    for dso in list_objs_in_datasets:
      if (inspect.ismodule(dso)):
        list_modules_in_datasets.append(dso)
    print(list_modules_in_datasets)
    print(&quot;Number of Modules in datasets = %d&quot; %(len(list_modules_in_datasets)))
    return (list_modules_in_datasets)
  
  if __name__ == '__main__':
  
    list_modules_in_datasets = get_list_of_modules_in_datasets()
  
    # print data for all dataframes from the datasets
    for ds in list_modules_in_datasets:
      df = ds.load_pandas().data
      print(list(df.columns))
      print(df.shape)
      print(df)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-07T14:35:50.960Z
Answers.LastActivityDate: 2022-07-07T14:42:48.887Z
Answers.LastEditDate: 2022-07-07T14:42:48.887Z
Answers.UserDisplayName: Marco Aurélio Falcão
Body: <p>The Python statsmodels library grants access to many R-datasets which can be downloaded e.g. with:</p>
  
  <pre><code>import statsmodels.api as sm
  df = sm.datasets.get_rdataset(dataname='iris', package='datasets').data
  </code></pre>
  
  <p>But for this you have to know the id or the name of the dataset.</p>
  
  <pre><code>sm.datasets.get_rdataset??
  Signature: sm.datasets.get_rdataset(dataname, package='datasets', cache=False)
  Source:   
  def get_rdataset(dataname, package="datasets", cache=False):
      """download and return R dataset
  
      Parameters
      ----------
      dataname : str
          The name of the dataset you want to download
  </code></pre>
  
  <p>There is a list of available datasets <a href="https://www.statsmodels.org/devel/datasets/index.html" rel="nofollow noreferrer">here</a>, but this list does not contain the identifiers. Also not the <a href="https://www.statsmodels.org/devel/datasets/generated/co2.html" rel="nofollow noreferrer">detailed view</a>.</p>
  
  <p>Is there an overview of all the available datasets that contains the ids e.g. "iris"?</p>
  
  <p>There is an <a href="https://vincentarelbundock.github.io/Rdatasets/datasets.html" rel="nofollow noreferrer">index</a> that is supposed to list all the datasets, but e.g. 'rice' as a name does not work.</p>
  
Tags: <python><statsmodels>
Title: How to retrieve dataset names from python statsmodels?
ThreadText: # How to retrieve dataset names from python statsmodels?
  
  (Asked by: username_0 on 2019-12-13)
  
  The Python statsmodels library grants access to many R-datasets which can be downloaded e.g. with:
  
  ```
  import statsmodels.api as sm
  df = sm.datasets.get_rdataset(dataname='iris', package='datasets').data
  
  ```
  
  But for this you have to know the id or the name of the dataset.
  
  ```
  sm.datasets.get_rdataset??
  Signature: sm.datasets.get_rdataset(dataname, package='datasets', cache=False)
  Source:   
  def get_rdataset(dataname, package="datasets", cache=False):
      """download and return R dataset
  
      Parameters
      ----------
      dataname : str
          The name of the dataset you want to download
  
  ```
  
  There is a list of available datasets [here](https://www.statsmodels.org/devel/datasets/index.html), but this list does not contain the identifiers. Also not the [detailed view](https://www.statsmodels.org/devel/datasets/generated/co2.html).
  
  Is there an overview of all the available datasets that contains the ids e.g. "iris"?
  
  There is an [index](https://vincentarelbundock.github.io/Rdatasets/datasets.html) that is supposed to list all the datasets, but e.g. 'rice' as a name does not work.
  
  **Tags:** python, statsmodels
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-12-20. Score: 1
  
  Here is the website of the creator of rdatasets I guess with the info you are looking for:
  
  <http://vincentarelbundock.github.io/Rdatasets/datasets.html>
  
  Here is a short look at it:
  
  ```
  Package     Item    Title   Rows    Cols    n_binary    n_character     n_factor    n_logical   n_numeric   CSV     Doc
  boot    acme    Monthly Excess Returns  60  3   0   1   0   0   2   CSV     DOC
  boot    aids    Delay in AIDS Reporting in England and Wales    570     6   1   0   0   0   6   CSV     DOC
  boot    aircondit   Failures of Air-conditioning Equipment  12  1   0   0   0   0   1   CSV     DOC
  boot    aircondit7  Failures of Air-conditioning Equipment  24  1   0   0   0   0   1   CSV     DOC
  boot    amis    Car Speeding and Warning Signs  8437    4   1   0   0   0   4   CSV     DOC
  boot    aml     Remission Times for Acute Myelogenous Leukaemia     23  3   2   0   0   0   3   CSV     DOC 
  ...
  
  ```
  
  I assume the Item column are the identifiers.
  
  > **Comments:**
  > **username_0**: As stated above, that does not seem to work. Try for example 'rice'.  
  > **username_1**: Did you change the package parameter to DAAG for the dataset rice? Since it’s not in the package datasets according to the index site.  
  
  ---
  
  ### Answer by username_2 on 2021-01-19. Score: 1
  
  You can view all the available datasets at this URL <https://github.com/vincentarelbundock/Rdatasets/blob/master/datasets.csv>
  
  The available ones in statsmodels are those with the tag `datasets` which looks like line 372 - 455.
  
  I didn't test them all, but everyone I tried from a small random sample seemed to work fine.
  
  
  ---
  
  ### Answer by username_3 on 2022-07-07. Score: 1
  
  Please, try this code to get all modules in datasets:
  
  ```
  import statsmodels.api as sm
  import inspect
  
  def get_list_of_modules_in_datasets():
    # get list of strings for the objects in datasets
    list_str_in_datasets = sm.datasets.__all__
    print(list_str_in_datasets)
    # get list of objects in datasets
    list_objs_in_datasets = [eval('sm.datasets.' + dsstr) for dsstr in list_str_in_datasets]
    print(list_objs_in_datasets)
    # get list of modules in datasets
    list_modules_in_datasets = []
    for dso in list_objs_in_datasets:
      if (inspect.ismodule(dso)):
        list_modules_in_datasets.append(dso)
    print(list_modules_in_datasets)
    print("Number of Modules in datasets = %d" %(len(list_modules_in_datasets)))
    return (list_modules_in_datasets)
  
  if __name__ == '__main__':
  
    list_modules_in_datasets = get_list_of_modules_in_datasets()
  
    # print data for all dataframes from the datasets
    for ds in list_modules_in_datasets:
      df = ds.load_pandas().data
      print(list(df.columns))
      print(df.shape)
      print(df)
  
  ```
  
  
  ---
  
  