12. StructType() & StructField() in PySpark |

Поделиться
HTML-код
  • Опубликовано: 6 янв 2025

Комментарии • 19

  • @manu77564
    @manu77564 2 года назад +6

    My humble request... please continue..

  • @peerkhaja2700
    @peerkhaja2700 2 года назад +1

    Ur always giving informative videos.. Keep it up maheer

  • @babarhassan7726
    @babarhassan7726 10 месяцев назад

    Thank you I needed this video 👍

  • @durgasiresh
    @durgasiresh 2 года назад

    Good explanation and great effort & very useful videos Thank you!!

  • @adityashrivastava860
    @adityashrivastava860 Год назад

    Beautiful explaination.

  • @polakigowtam183
    @polakigowtam183 2 года назад +1

    Good Vedio . Thanks Maheer

  • @ITKaksha
    @ITKaksha 4 месяца назад +2

    Good explanation. I have one query, I other videos, you have also used below format
    StructType().add(field='id',data_type=IntegerType())
    In this video, you have slightly format
    StructType([StructField(name='id','dataType=IntegerType())
    Are both these same ?

    • @sahildhar6805
      @sahildhar6805 4 месяца назад

      Yes

    • @srinureddy378
      @srinureddy378 4 месяца назад

      Yes, but different syntax, and we have few more ways to define schema

  • @jeevaraj815
    @jeevaraj815 2 года назад

    Hi Sir your videos are helpful for me.I learned very much with your videos.... One humble request if is possible means you can do it, Atleast one video per day or 5 videos per week. Thanks in advance

  • @subhanishaik8163
    @subhanishaik8163 2 года назад +1

    Hi i have one question.how to convert 11/11/2022 1102 to YYYY-MM-DD HH:MM:ss in pyspark

    • @menaga.g
      @menaga.g 7 месяцев назад +1

      Hi @subhanishaik8163
      By using date_format():
      df = df.withColumn('date_time_str' , lit('2022/11/11 1102'))
      df1 = df.withColumn('New', date_format(to_timestamp(df.date_time_str, 'yyyy/MM/dd HHmm'), 'yyyy-MM-dd HH:mm'))
      OUTPUT:
      date_time_str New
      2022/11/11 1102 2022-11-11 11:02
      2022/11/11 1102 2022-11-11 11:02

  • @vutv5742
    @vutv5742 10 месяцев назад

    Completed🎉🎉🎉

  • @Ali-q4d4c
    @Ali-q4d4c Год назад

    👍🏻

  • @VinayKumar-st9iq
    @VinayKumar-st9iq Год назад

    Abyone help me. For me getting type error while excecutung below code
    error
    TypeError: __call__() takes 1 positional argument but 2 were given
    Code:
    from pyspark.sql.types import StringType, StructField, StringType, IntegerType
    data = [(1,'Narendra',2000),(2,'Modi',5000)]
    schema = StringType([\
    StructField(name='id',dataType=IntegerType()),\
    StructField(name='Name',dataType=StringType()),\
    StructField(name='Salary',dataType=IntegerType())])

    df = spark.createDataFrame(data,schema)
    df.show()

    • @prasanthrajagopal158
      @prasanthrajagopal158 Год назад +1

      You are using "schema=StringType", I think thats a typo. Use "StructType()"