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

Поділитися
Вставка
  • Опубліковано 13 жов 2024

КОМЕНТАРІ • 19

  • @manu77564
    @manu77564 Рік тому +6

    My humble request... please continue..

  • @ITKaksha
    @ITKaksha 2 місяці тому +1

    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 Місяць тому

      Yes

    • @srinureddy378
      @srinureddy378 Місяць тому

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

  • @peerkhaja2700
    @peerkhaja2700 Рік тому +1

    Ur always giving informative videos.. Keep it up maheer

  • @durgasiresh
    @durgasiresh Рік тому

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

  • @babarhassan7726
    @babarhassan7726 7 місяців тому

    Thank you I needed this video 👍

  • @adityashrivastava860
    @adityashrivastava860 Рік тому

    Beautiful explaination.

  • @jeevaraj815
    @jeevaraj815 Рік тому

    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

  • @polakigowtam183
    @polakigowtam183 Рік тому +1

    Good Vedio . Thanks Maheer

  • @subhanishaik8163
    @subhanishaik8163 Рік тому +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 4 місяці тому

      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 7 місяців тому

    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()"