<?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 How can I create a new calculated field in databricks by using pyspark. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/45468#M27889</link>
    <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;Great people. I am new to Databricks and pyspark learning. How can I create a new column called "sub_total"? Where I want to group by "category" "subcategory" and "monthly" sales value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your empathic solution.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 21:21:08 GMT</pubDate>
    <dc:creator>kazinahian</dc:creator>
    <dc:date>2023-09-20T21:21:08Z</dc:date>
    <item>
      <title>How can I create a new calculated field in databricks by using pyspark.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/45468#M27889</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;Great people. I am new to Databricks and pyspark learning. How can I create a new column called "sub_total"? Where I want to group by "category" "subcategory" and "monthly" sales value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your empathic solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 21:21:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/45468#M27889</guid>
      <dc:creator>kazinahian</dc:creator>
      <dc:date>2023-09-20T21:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new calculated field in databricks by using pyspark.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/106745#M42572</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/88000"&gt;@kazinahian&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I believe what you're looking for is the &lt;EM&gt;.withColumn()&lt;/EM&gt; Dataframe method in PySpark. It will allow you to create a new column with aggregations on other columns:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/pyspark/basics.html#create-columns" target="_blank"&gt;https://docs.databricks.com/en/pyspark/basics.html#create-columns&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 04:31:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/106745#M42572</guid>
      <dc:creator>Miguel_Suarez</dc:creator>
      <dc:date>2025-01-23T04:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a new calculated field in databricks by using pyspark.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/108273#M43015</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I want to group by "category" "subcategory" and "monthly" sales value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sub_total_df = df.groupBy("category", "subcategory", "monthly").agg(sum("sales_value").alias("sub_total"))&lt;/LI-CODE&gt;
&lt;P&gt;You could always type in your query in the Databricks notebook, by clicking on the generate link in cell, which will help you with Databricks Assistant.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2025 07:29:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-new-calculated-field-in-databricks-by-using/m-p/108273#M43015</guid>
      <dc:creator>NandiniN</dc:creator>
      <dc:date>2025-02-01T07:29:37Z</dc:date>
    </item>
  </channel>
</rss>

