class_docstr: Test behaviour of the from_pandas method
docstr: Structure learnt from larger lambda should be sparser than smaller lambda
docstr_tok: ["Structure","learnt","from","larger","lambda","should","be","sparser","than","smaller","lambda"]
code: def test_sparsity(self, train_data_idx):
      """Structure learnt from larger lambda should be sparser than smaller lambda"""
  
      g1 = from_pandas(
          train_data_idx, lasso_beta=10.0, w_threshold=0.25
      )
      g2 = from_pandas(
          train_data_idx, lasso_beta=1e-6, w_threshold=0.25
      )
      assert len(g1.edges) < len(g2.edges)
  
imports: import logging
  import networkx
  import numpy
  import pandas
  import pytest
  import scipy.optimize
  from mock import patch
  from causalnex.structure import StructureModel
  from causalnex.structure.data_generators import generate_binary_data, generate_binary_dataframe, generate_continuous_dataframe, generate_count_dataframe, generate_structure
  from causalnex.structure.pytorch.notears import from_numpy, from_pandas
label_desc: Use image node_id 14 for calling the TestFromPandas obj's underlying member method code with example usage: obj.test_sparsity(train_data_idx) without return types