code: def test_log_rank_test_on_waltons_dataset_with_case_weights():
      df = load_waltons()
      ix = df["group"] == "miR-137"
      waltonT1 = df.loc[ix]["T"]
      waltonT2 = df.loc[~ix]["T"]
      result = stats.logrank_test(waltonT1, waltonT2)
      print(result)
  
      dfw = (
          df.groupby(["T", "E", "group"])
          .size()
          .reset_index()
          .rename(columns={0: "weights"})
      )
      ixw = dfw["group"] == "miR-137"
      waltonT1w = dfw.loc[ixw]["T"]
      waltonT2w = dfw.loc[~ixw]["T"]
  
      weightsA = dfw.loc[ixw]["weights"]
      weightsB = dfw.loc[~ixw]["weights"]
  
      resultw = stats.logrank_test(
          waltonT1w, waltonT2w, weights_A=weightsA, weights_B=weightsB
      )
      assert_frame_equal(resultw.summary, result.summary)
  
imports: import numpy
  import pandas
  import numpy.testing
  import pytest
  from pandas.testing import assert_frame_equal
  from lifelines import statistics
  from lifelines import CoxPHFitter, KaplanMeierFitter, WeibullFitter
  from lifelines.exceptions import StatisticalWarning
  from lifelines.datasets import load_waltons, load_g3, load_lymphoma, load_dd, load_regression_dataset, load_leukemia
label_desc: Use image node_id 19 for calling a global function with example usage: test_log_rank_test_on_waltons_dataset_with_case_weights() without return types