<?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 Re: PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11603#M6551</link>
    <description>&lt;P&gt;Hi @Hubert Dudek​&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried, hard coded data Frame input data , its working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if am loading same data from file getting above mentioned error, do you have any idea.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 05:20:20 GMT</pubDate>
    <dc:creator>Ancil</dc:creator>
    <dc:date>2023-01-18T05:20:20Z</dc:date>
    <item>
      <title>PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'.</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11600#M6548</link>
      <description>&lt;P&gt;I have pandas_udf, its working for 1 rows, but I tried with more than one rows getting below error.&lt;/P&gt;&lt;P&gt;&lt;B&gt;PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Code&lt;/U&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;@func.pandas_udf(StringType())
&amp;nbsp;
def find_data(inputs : Iterator[pd.Series]) -&amp;gt; Iterator[pd.Series]:
&amp;nbsp;
       for input in inputs :
&amp;nbsp;
           --doing logic have for loop, if etc.
&amp;nbsp;
           yield pd.Series(str(result_json))
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
df = df.withColumn("outData",find_data("inputData"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 11:08:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11600#M6548</guid>
      <dc:creator>Ancil</dc:creator>
      <dc:date>2023-01-17T11:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'.</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11601#M6549</link>
      <description>&lt;P&gt;I was testing, and your function is correct. So you need to have an error in inputData&lt;/P&gt;&lt;P&gt; type (is all string) or with result_json. Please also check the runtime version. I was using 11 LTS.&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/837iB8A53B278655D9F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:18:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11601#M6549</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-17T12:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'.</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11602#M6550</link>
      <description>&lt;P&gt;Thanks @Hubert Dudek​&amp;nbsp;.  Let me check the version.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:41:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11602#M6550</guid>
      <dc:creator>Ancil</dc:creator>
      <dc:date>2023-01-17T12:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: 'RuntimeError: The length of output in Scalar iterator pandas UDF should be the same with the input's; however, the length of output was 1 and the length of input was 2.'.</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11603#M6551</link>
      <description>&lt;P&gt;Hi @Hubert Dudek​&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried, hard coded data Frame input data , its working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if am loading same data from file getting above mentioned error, do you have any idea.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 05:20:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-runtimeerror-the-length-of-output-in-scalar/m-p/11603#M6551</guid>
      <dc:creator>Ancil</dc:creator>
      <dc:date>2023-01-18T05:20:20Z</dc:date>
    </item>
  </channel>
</rss>

