|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/topdataengineervoice/
课程评论:没有评论
课程名称:TopDataEngineerVoice 课程概述: 欢迎参加终极PySpark面试问题练习测试课程!无论您是准备面试,还是希望加强对PySpark概念的理解以增强信心,这个课程都将帮助您掌握PySpark并在面试中脱颖而出。随着PySpark在大数据处理和分析中的流行,掌握其概念对于希望从事数据工程、数据科学或分析职位的人员至关重要。 课程分为五个主要部分,全面覆盖PySpark的各个主题: 1. **PySpark基础函数**:涵盖100多个基础函数,包含示例和详细场景,帮助学员理解这些函数的核心概念。 2. **高级PySpark概念**:提升PySpark技能,内容包括用户自定义函数(UDFs)、窗口函数、广播连接和集成等高级主题。 3. **中级PySpark问题**:详细讲解第一轮面试问题和答案,帮助学员提升解决高级面试问题的速度和自信心。 4. **高级PySpark问题**:涵盖第二轮面试的高级问题和答案,设计旨在培养学员应对更高层次面试问题的能力。 5. **问题关键点**:提供来自IT行业不同公司的面试问题汇总,每个问题均附有提问的时间、地点及公司等详细信息。 示例问题包括: - **问题1**:计算每个日期距离年底剩余多少天,并提供详细的解决方案和预期的数据框结果。 - **问题2**:分析零售公司的月销售表现记录,计算每个地区的累计销售额和每月的销售排名。 - **问题3**:验证源数据集与目标数据集之间的数据,处理匹配值、缺失数据及识别不一致之处。 这个全面的课程让您在PySpark面试中备战充分,提升您的职业竞争力!
300+ PySpark Scenarios Based Interview Questions & Answers Preparation Practice Test Freshers to Experienced Detailed Explanations!!Welcome to the ultimate PySpark Interview Questions Practice Test course! If you're gearing up for a job interview that demands PySpark knowledge, or if you want to strengthen your understanding of PySpark concepts and build confidence before tackling real interview situations, you're in the right place! This all-inclusive practice test course is crafted to help you master PySpark and excel in your interviews with confidence.As PySpark continues to rise in popularity within the world of big data processing and analysis, gaining a strong grasp of its concepts is essential for those aiming for roles in data engineering, data science, or analytics. This course is divided into five key sections, each thoughtfully designed to cover a comprehensive range of PySpark topics.PySpark Basic Functions: This section covers the fundamentals of PySpark functions, featuring 100+ functions, each explained with examples and detailed scenarios to help you understand the core concepts of these functions.Advanced PySpark Concepts: Take your PySpark skills to the next level with advanced topics such as UDFs, window functions, broadcast joins, integration.PySpark Medium-Level Questions: This section covers Interview Round 1 questions and answers, explained in detail. These questions are designed to help you build speed and confidence in tackling advanced-level interview questions.PySpark Advanced-Level Questions: This section covers advanced-level Round 2 questions and answers, explained in detail. These questions are designed to help you build speed and confidence in tackling higher-level interview questions.Key Points of Questions: This section provides a breakdown of interview questions collected from various companies in the IT industry. Each question is accompanied by details on when and where it was asked, the year it was posed, and which company asked it during live interviewsHere are demonstration of interview- Question & In details examplanation along with Expected Dataframe results:Question 1: [Persistent Technology -2025]:You are given a dataset('sampledata') containing a column with date values in the format 'yyyy-MM-dd HH:mm:ss'. Your task is to calculate how many days remain from each date until the end of that year (December 31st).For demonstration - Lets suppose your date input is this '2025-01-01', and you should write a script to calculate ,How many days are left in the year 2025 after January 1st"#sampledatasampledata = [('2025-01-10 12:10:00'),('2025-02-10 12:10:00'),('2025-04-10 12:10:00')]Solution & Explanation:# Imports required library:import pysparkfrom pyspark.sql import SparkSessionfrom pyspark.sql.functions import*from pyspark.sql.types import*from pyspark.sql import functions as f# Initialize Spark Session:spark = SparkSession.builder.appName('udemy').master('local[1]').getOrCreate()# Step 1: To create a dataframe with given sample data as:# Define the schema for dataframe as:schema = ['dateColumn']dataframe = spark.createDataFrame(data = sampledata , schema = schema)# Show the dataframe as loaded.display(dataframe)# Step 2: To convert dateColumn to date format as required fur transformation:dataframeDate = dataframe.withColumn('dateColumn' , to_date(col('dateColumn'),'yyyy-MM-dd HH:mm:ss'))# Show the dataframe as loaded.display(dataframeDate)# Step 4: To add a new column with the last month date ('31-12') and extract year for column as:dataframeAddate = dataframeDate.withColumn('YearOfEnd',to_date(concat(lit('31-12-'), year(col('dateColumn')).cast('string')), 'dd-MM-yyyy'))# Show the dataframe as loaded.display(dataframeAddate)# Step 5: To applying the datediff function to get total days which are left as:dataframeFinal = dataframeAdddate.withColumn('DaysLeft', datediff('YearOfEnd' , 'dateColumn'))# Show final the dataframe as expected as:display(dataframeFinal)Question 2: [LTIMindTree-2025]:Imagine you are analyzing the monthly sales performance records of retail company across multiple regions. I would like to ask you to perform the task as given in poits:1. To calcaulte the cumulative sales for each region over months.2. To generate the rank of each month based on sales within the same region.#sampledatasampledata = [ ("East", "March", 400), ("East", "April", 300), ("East", "May", 650), ("West", "June", 900), ("West", "July", 370), ("West", "August", 850)]Solution & Explanation:# Imports required library:import pysparkfrom pyspark.sql import SparkSessionfrom pyspark.sql.functions import*from pyspark.sql.types import*from pyspark.sql import functions as f# Initialize Spark Session:spark = SparkSession.builder.appName('udemy').master('local[1]').getOrCreate()# Step 1: To create a dataframe with given sample data as:# Define the schema for dataframe as:schema = ["Region", "Month", "Sales"]dataframe = spark.createDataFrame(data = sampledata , schema = schema)# Show the dataframe as loadeddisplay(dataframe)# Step 2: To applying window function get partiton on columns records as:windowSp = Window.partitionBy('Region').orderBy('Sales')# Step 3: This window function being applying for Rank of desc ordering as:WindowRank = Window.partitionBy('Region').orderBy(f.desc('Sales'))# Step 4: To calculate the cumulative sum & Rank on columns records as:dataframeFinal = dataframe.withColumn('CumulativeSales',f.sum('Sales')./over(windowSp)).withColumn('CumulativeRank',f.rank().over(WindowRank))# Show final the dataframe as expected as:display(dataframeFinal)Question 3: [PWC -2025]:Assume that as you are working with Ingestion team , However , how would you validate the data between a source and target dataset using PySpark ? Specifically, how would you handle the comparison of records in terms of matching values, missing data, and identifying any discrepancies between the two datasets?#sampledatasampledataSource = [(100,'M'),(200,'N'),(300,'O'),(400,'P'),(500,'Q')]sampledataTarget = [(100,'M'),(200,'N'),(300,'Z'),(400,'X'),(500,'Y')]Solution & Explanation:# Imports required library:import pysparkfrom pyspark.sql import SparkSessionfrom pyspark.sql.functions import*from pyspark.sql.types import*from pyspark.sql import functions as f# Initialize Spark Session:spark = SparkSession.builder.appName('udemy').master('local[1]').getOrCreate()# Step 1: Create a dataframe with 'sampledataSource' & 'sampledataTarget' as:dataframe = spark.createDataFrame(data = sampledataSource , schema = ['SourceId','ProductName'])display(dataframe)dataframeTarget = spark.createDataFrame(data = sampledataTarget , schema = ['ProductId','ProductName'])display(dataframeTarget)# Step 2: To Join the both dataframe as like source & Target as:dataframeJoin = dataframe.alias('Table1').join(dataframeTarget.alias('Table2'),on = col('Table1.SourceId') == col('Table2.ProductId'),how='full')display(dataframeJoin)# Step 3: To use alias for column naming as readable as:dataframeAlias (dataframeJoin).select(col('Table1.SourceId').alias('SourceId'),col('Table2.ProductId').alias('TargetId'),col('Table1.ProductName').alias('SourecName'),col('Table2.ProductName').alias('TargetName'))display(dataframeAlias)# Step 4: To Add a new columns as 'Mismatched' and compare each records as:dataframeMismatch = dataframeAlias.withColumn( 'Mismatched', when((col('SourceId') == col('TargetId')) & (col('SourecName')!= col('TargetName')), 'Mismatched') .when(col('TargetId').isNull(), 'NewRecords in source') .when(col('SourceId').isNull(), 'New records in Target Table') .otherwise('No mismatch'))display(dataframeMismatch)# Step 5: To filter missing(value) in columns as:dataframeFilter = dataframeMismatch.filter(col('Mismatched').isNotNull())display(dataframeFilter)