<?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 Change From Python to M query in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Change-From-Python-to-M-query/m-p/2203441#M33082</link>
    <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Hello I made a power bi project but during this project I used 2 python scripts; the problem is that I discovered after that standard gateway does not support python so I have to change these 2 scripts or convert them i really need your support&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;first script Python :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;# 'dataset' holds the input data for this script&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;import pandas as pd &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;DX= pd.DataFrame(dataset.loc[:,])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA = []&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;for i in range(0, len(DX)):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;if(DX['stock initial'][i] &amp;gt; 0):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;var = DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;var = var + DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;DX['cumul Consommation']=AAA&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abderrazak_0-1637665422279.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/635013iFCDCD8F426494F89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abderrazak_0-1637665422279.png" alt="abderrazak_0-1637665422279.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;second script python&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#333399"&gt;# 'dataset' holds the input data for this script&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;import pandas as pd &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;DX= pd.DataFrame(dataset.loc[:,])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA = []&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;for i in range(0, len(DX)):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;if(DX['stock initial'][i] &amp;gt; 0):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;var = DX['stock initial'][i] + DX['Livr_prevue'][i]-DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;var = var + DX['Livr_prevue'][i]-DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;DX['stock Final']=AAA&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abderrazak_1-1637665529875.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/635014i59F538B193F0579E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abderrazak_1-1637665529875.png" alt="abderrazak_1-1637665529875.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thnks for ur support&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 10:08:54 GMT</pubDate>
    <dc:creator>abderrazak</dc:creator>
    <dc:date>2021-11-23T10:08:54Z</dc:date>
    <item>
      <title>Change From Python to M query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Change-From-Python-to-M-query/m-p/2203441#M33082</link>
      <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Hello I made a power bi project but during this project I used 2 python scripts; the problem is that I discovered after that standard gateway does not support python so I have to change these 2 scripts or convert them i really need your support&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;first script Python :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;# 'dataset' holds the input data for this script&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;import pandas as pd &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;DX= pd.DataFrame(dataset.loc[:,])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA = []&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;for i in range(0, len(DX)):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;if(DX['stock initial'][i] &amp;gt; 0):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;var = DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;var = var + DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="book antiqua,palatino" size="2" color="#333399"&gt;DX['cumul Consommation']=AAA&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abderrazak_0-1637665422279.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/635013iFCDCD8F426494F89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abderrazak_0-1637665422279.png" alt="abderrazak_0-1637665422279.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;second script python&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#333399"&gt;# 'dataset' holds the input data for this script&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;import pandas as pd &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;DX= pd.DataFrame(dataset.loc[:,])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA = []&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;for i in range(0, len(DX)):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;if(DX['stock initial'][i] &amp;gt; 0):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;var = DX['stock initial'][i] + DX['Livr_prevue'][i]-DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;var = var + DX['Livr_prevue'][i]-DX['CONSO'][i]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;AAA.append(var)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;DX['stock Final']=AAA&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abderrazak_1-1637665529875.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/635014i59F538B193F0579E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abderrazak_1-1637665529875.png" alt="abderrazak_1-1637665529875.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thnks for ur support&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 10:08:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Change-From-Python-to-M-query/m-p/2203441#M33082</guid>
      <dc:creator>abderrazak</dc:creator>
      <dc:date>2021-11-23T10:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change From Python to M query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Change-From-Python-to-M-query/m-p/2204345#M33092</link>
      <description>&lt;P&gt;You can replace these scripts with List.Accumulate()&amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 19:51:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Change-From-Python-to-M-query/m-p/2204345#M33092</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-11-23T19:51:32Z</dc:date>
    </item>
  </channel>
</rss>

