pyspark 数据框中的 rdd 是什么意思

编程入门 行业动态 更新时间:2024-10-12 20:23:15
本文介绍了pyspark 数据框中的 rdd 是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我是 pyspark 的新手.我想知道 pyspark 数据框中的 rdd 是什么意思.

I am new to to pyspark. I am wondering what does rdd mean in pyspark dataframe.

weatherData = spark.read.csv('weather.csv', header=True, inferSchema=True)

这两行代码有相同的输出.我想知道 rdd 有什么影响

These two line of the code has the same output. I am wondering what the effect of having rdd

weatherData.collect()
weatherData.rdd.collect()

推荐答案

数据框是一个表格,或类似二维数组的结构,其中每一列包含一个变量的测量值,每一行包含一个案例.

A data frame is a table, or two-dimensional array-like structure, in which each column contains measurements on one variable, and each row contains one case.

因此,DataFrame 由于其表格格式而具有额外的元数据,这允许 Spark 对最终查询运行某些优化.

So, a DataFrame has additional metadata due to its tabular format, which allows Spark to run certain optimizations on the finalized query.

RDD,另一方面,只是一个R弹性D分布式Dataset,它是更多的是无法优化的数据黑匣子,因为可以对其执行的操作不受约束.

An RDD, on the other hand, is merely a Resilient Distributed Dataset that is more of a blackbox of data that cannot be optimized as the operations that can be performed against it, are not as constrained.

但是,您可以通过 .rdd 方法从 DataFrameRDD,并且可以从 RDD 到DataFrame(如果RDD是表格格式)通过.toDF()方法

However, you can go from a DataFrame to an RDD via its .rdd method, and you can go from an RDD to a DataFrame (if the RDD is in a tabular format) via the .toDF() method

一般情况下,由于内置查询优化,建议尽可能使用 DataFrame.

In general, it is recommended to use a DataFrame where possible due to the built in query optimization.

这篇关于pyspark 数据框中的 rdd 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 19:42:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/947147.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框中   数据   pyspark   rdd

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!