<?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: how to check dataframe column value in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11715#M6656</link>
    <description>&lt;P&gt;Code without collect, which should not be used in production:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if df.filter("count &amp;gt; 0").count() &amp;gt; 0: dbutils.notebook.exit('Notebook Failed')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;you can also use a more aggressive version:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if df.filter("count &amp;gt; 0").count() &amp;gt; 0: raise Exception("count bigger than 0")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 09:44:03 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2023-01-17T09:44:03Z</dc:date>
    <item>
      <title>how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11713#M6654</link>
      <description>&lt;P&gt;in my dataframe it have one column name like count, if that particular column value is greater than zero, the job needs to get failed, how can i perform that one?​&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 01:29:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11713#M6654</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-17T01:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11714#M6655</link>
      <description>&lt;P&gt;Hi @Mohammed sadamusean​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you try like below code in pyspark and let me know if you face any issues&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;variable_name = df.select(col("Column_Name")).collect()[0][0]
&amp;nbsp;
if(variable_name&amp;gt;0):
dbutils.notebook.exit('Notebook Failed')  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Happy Learning!!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 03:26:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11714#M6655</guid>
      <dc:creator>Chaitanya_Raju</dc:creator>
      <dc:date>2023-01-17T03:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11715#M6656</link>
      <description>&lt;P&gt;Code without collect, which should not be used in production:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if df.filter("count &amp;gt; 0").count() &amp;gt; 0: dbutils.notebook.exit('Notebook Failed')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;you can also use a more aggressive version:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if df.filter("count &amp;gt; 0").count() &amp;gt; 0: raise Exception("count bigger than 0")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 09:44:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11715#M6656</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-17T09:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11716#M6657</link>
      <description>&lt;P&gt;but it will get total count of the column right​, but i need to check every specific column value&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 11:14:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11716#M6657</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-17T11:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11717#M6658</link>
      <description>&lt;P&gt;first you filter for rows matching your query. You said that column is named count. Let's assume that column is called col instead, so filter("col &amp;gt; 0"), and then you apply the count() function, which will return how many rows match those criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:02:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11717#M6658</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-17T12:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11718#M6659</link>
      <description>&lt;P&gt;it is working but ​how can we check the columns based on two values like count &amp;gt;0 and less than 0 , i tried with equal to 0 but it doesn't worked&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:17:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11718#M6659</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-17T12:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to check dataframe column value</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11719#M6660</link>
      <description>&lt;P&gt;just put like in SQL&lt;/P&gt;&lt;P&gt; "colname &amp;gt; 0 OR colname&amp;lt; 0"&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;"colname != 0"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:21:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-check-dataframe-column-value/m-p/11719#M6660</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-17T12:21:32Z</dc:date>
    </item>
  </channel>
</rss>

