Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть How to create a dataframe from a text file

  • BigDataElearning
  • 2021-06-03
  • 2068
How to create a dataframe from a text file
  • ok logo

Скачать How to create a dataframe from a text file бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно How to create a dataframe from a text file или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку How to create a dataframe from a text file бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео How to create a dataframe from a text file

https://bigdataelearning.com/course/a...
https://bigdataelearning.com/courses
https://bigdataelearning.com
Creating a dataframe from a text file involves 4 steps.
1. First is to create a RDD from the text file
2. Second step is to create a case class
3. Third step is to convert the RDD to row RDD using case class
4. Final step is to create dataframe from the schema RDD using to-DF method.

1. Let’s look at the first step of creating RDD. As we already know, this is done using the text file method of sparkContext object. Let’s create a RDD from a text file. Here I am using spark.sparkContext.textFile API to load the data. I am specifying the path to the text file within double quotes and enclosing with round braces.

This creates a RDD called employeeRdd.

issuing a cat statement to view the contents of the employee.text file. Here we can see that the individual fields are separated by comma.

2. Now let’s do the second step of creating case class. Creating case class is easy.
All we should do is type

case class caseclassname & within braces fields names and their data types separated by comma.

3. Now, let’s do the third step of converting it to row RDD using the case class. For this, applying Map transformation to the employeeRDD, to split the individual elements of the RDD, by using split function and by using ‘comma’ as the delimiter. On top of that, applying another map transformation to convert as Row object, with the first field as integer and to trim the second field for each of the records. This creates a RDD called empRowRdd.

4. Finally, we can apply toDF method on the empRowRdd to create employee-Df dataframe. Now that we have created employeeDf successfully, let’s see how to save the contents of the dataframe to external text file.

This can be done using saveAsTextFile method. applying rdd.saveAsTextFile on the dataframe. passing the destination file path within double quotes enclosed by round braces.

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]