code: def test_load_form_df():
      """Ensure reading dataset from pandas dataframe is OK."""
  
      # DF creation.
      ratings_dict = {
          "itemID": [1, 1, 1, 2, 2],
          "userID": [9, 32, 2, 45, "10000"],
          "rating": [3, 2, 4, 3, 1],
      }
      df = pd.DataFrame(ratings_dict)
  
      reader = Reader(rating_scale=(1, 5))
      data = Dataset.load_from_df(
          df[["userID", "itemID", "rating"]], reader
      )
  
      # assert users and items are correctly mapped
      trainset = data.build_full_trainset()
      assert trainset.knows_user(trainset.to_inner_uid(9))
      assert trainset.knows_user(trainset.to_inner_uid("10000"))
      assert trainset.knows_item(trainset.to_inner_iid(2))
  
      # assert r(9, 1) = 3 and r(2, 1) = 4
      uid9 = trainset.to_inner_uid(9)
      uid2 = trainset.to_inner_uid(2)
      iid1 = trainset.to_inner_iid(1)
      assert trainset.ur[uid9] == [(iid1, 3)]
      assert trainset.ur[uid2] == [(iid1, 4)]
  
      # assert at least rating file or dataframe must be specified
      with pytest.raises(ValueError):
          data = Dataset.load_from_df(None, None)
  
      # mess up the column ordering and assert that users are not correctly
      # mapped
      data = Dataset.load_from_df(
          df[["rating", "itemID", "userID"]], reader
      )
      trainset = data.build_full_trainset()
      with pytest.raises(ValueError):
          trainset.to_inner_uid("10000")
  
file_path: Surprise/tests/test_dataset.py
imports: import os
  import random
  import pandas
  import pytest
  from surprise import BaselineOnly, Dataset, Reader
  from surprise.builtin_datasets import get_dataset_dir
  from surprise.model_selection import KFold, PredefinedKFold
label_desc: Use image node_id 4 for calling a global function with example usage: test_load_form_df() without return types