<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic We are trying to Pass parameter to python Script in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/We-are-trying-to-Pass-parameter-to-python-Script/m-p/3679439#M49332</link>
    <description>&lt;P&gt;We have created two parameter named as storeval and itemval. we want to to pass these two parameter to our python Script code but we are not getting the table output from our Python Script please check below Snap&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SushilSingh10_0-1707115288654.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1037204iE7452AE27C494C87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SushilSingh10_0-1707115288654.png" alt="SushilSingh10_0-1707115288654.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SushilSingh10_1-1707115912361.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1037210i475284C7ACE2E817/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SushilSingh10_1-1707115912361.png" alt="SushilSingh10_1-1707115912361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 06:53:42 GMT</pubDate>
    <dc:creator>SushilSingh10</dc:creator>
    <dc:date>2024-02-05T06:53:42Z</dc:date>
    <item>
      <title>We are trying to Pass parameter to python Script</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/We-are-trying-to-Pass-parameter-to-python-Script/m-p/3679439#M49332</link>
      <description>&lt;P&gt;We have created two parameter named as storeval and itemval. we want to to pass these two parameter to our python Script code but we are not getting the table output from our Python Script please check below Snap&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SushilSingh10_0-1707115288654.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1037204iE7452AE27C494C87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SushilSingh10_0-1707115288654.png" alt="SushilSingh10_0-1707115288654.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SushilSingh10_1-1707115912361.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1037210i475284C7ACE2E817/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SushilSingh10_1-1707115912361.png" alt="SushilSingh10_1-1707115912361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:53:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/We-are-trying-to-Pass-parameter-to-python-Script/m-p/3679439#M49332</guid>
      <dc:creator>SushilSingh10</dc:creator>
      <dc:date>2024-02-05T06:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: We are trying to Pass parameter to python Script</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/We-are-trying-to-Pass-parameter-to-python-Script/m-p/3680043#M49359</link>
      <description>&lt;P&gt;Hi Sushil,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There might be many ways of solving this requirement. Here is my solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Financials is the name of the query and paramSegment is the parameter name.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-02-05 at 4.15.19 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1037400i235B6135263E2102/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-02-05 at 4.15.19 PM.png" alt="Screenshot 2024-02-05 at 4.15.19 PM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Pass the data as well as the parmeter values as input to the Python.Execute function and then you will be able to access them, I am attaching the code for your reference&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
  Source = Excel.Workbook(
    File.Contents(
      &amp;lt;Path&amp;gt;
    ),
    null,
    true
  ),
  financials_Table = Source{[Item = "financials", Kind = "Table"]}[Data],
  #"Changed Type" = Table.TransformColumnTypes(
    financials_Table,
    {
      {"Segment", type text},
      {"Country", type text},
      {"Product", type text},
      {"Discount Band", type text},
      {"Units Sold", type number},
      {"Manufacturing Price", Int64.Type},
      {"Sale Price", Int64.Type},
      {"Gross Sales", type number},
      {"Discounts", type number},
      {" Sales", type number},
      {"COGS", type number},
      {"Profit", type number},
      {"Date", type date},
      {"Month Number", Int64.Type},
      {"Month Name", type text},
      {"Year", Int64.Type}
    }
  ),
  GatherParameters = Table.ExpandRecordColumn(
    Table.FromList(
      {[Parameter = "Segment", Value = paramSegment]},
      Splitter.SplitByNothing(),
      null,
      null,
      ExtraValues.Error
    ),
    "Column1",
    {"Parameter", "Value"}
  ),
  PrepareInputforPY = Table.ExpandRecordColumn(
    Table.FromList({[Data = #"Changed Type", Params = GatherParameters]}, Splitter.SplitByNothing()),
    "Column1",
    {"Data", "Params"}
  ),
  #"Run Python script" = Python.Execute(
    "# 'dataset' holds the input data for this script#(lf)# dataset.drop(dataset[dataset['Segment'] == 'Government'].index, inplace=True)#(lf)segment = Params[Params['Parameter'] == 'Segment']['Value'][0]#(lf)dataset.drop(dataset[dataset['Segment'] != segment].index, inplace=True)#(lf)#(lf)",
    [dataset = PrepareInputforPY[Data]{0}, Params = PrepareInputforPY[Params]{0}]
  ),
  dataset = #"Run Python script"{[Name = "dataset"]}[Value]
in
  dataset&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Hope this answers your question. If yes then please accept my solution.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Tharun&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 10:49:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/We-are-trying-to-Pass-parameter-to-python-Script/m-p/3680043#M49359</guid>
      <dc:creator>tharunkumarRTK</dc:creator>
      <dc:date>2024-02-05T10:49:32Z</dc:date>
    </item>
  </channel>
</rss>

