code: def test_take_in_group_by() -> None:
      df = pl.DataFrame(
          {
              "group": [1, 1, 1, 2, 2, 2],
              "values": [10, 200, 3, 40, 500, 6],
          }
      )
      assert df.group_by("group").agg(
          pl.col("values").get(1) - pl.col("values").get(2)
      ).sort("group").to_dict(as_series=False) == {
          "group": [1, 2],
          "values": [197, 494],
      }
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from datetime import datetime, timedelta
  from typing import Any
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 18 for calling a global function with example usage: test_take_in_group_by() without return types