Showing posts with the label apache-spark-sql

[FIXED] Pyspark dataframe how to drop rows with nulls in all columns?

Issue For a dataframe, before it is like: +----+----+----+ | ID|TYPE|CODE| +----+----+----+ | …

[FIXED] Remove an element from a Python list of lists in PySpark DataFrame

Issue I am trying to remove an element from a Python list of lists: +---------------+ | so…

[FIXED] PySpark: compute row maximum of the subset of columns and add to an exisiting dataframe

Issue I would like to compute the maximum of a subset of columns for each row and add it as a new c…

[FIXED] How do I order fields of my Row objects in Spark (Python)

Issue I'm creating Row objects in Spark. I do not want my fields to be ordered alphabetically. …

[FIXED] JSON file parsing in Pyspark

Issue I am very new to Pyspark. I tried parsing the JSON file using the following code from pyspa…

[FIXED] How to speed up spark df.write jdbc to postgres database?

Issue I am new to spark and am attempting to speed up appending the contents of a dataframe, (that …

[FIXED] Fill Pyspark dataframe column null values with average value from same column

Issue With a dataframe like this, rdd_2 = sc.parallelize([(0,10,223,"201601"), (0,10,83…

[FIXED] Cant connect to Mysql database from pyspark, getting jdbc error

Issue I am learning pyspark, and trying to connect to a mysql database. But i am getting a java.l…

[FIXED] Can I read multiple files into a Spark Dataframe from S3, passing over nonexistent ones?

Issue I would like to read multiple parquet files into a dataframe from S3. Currently, I'm usin…

[FIXED] SparkSQL on pyspark: how to generate time series?

Issue I'm using SparkSQL on pyspark to store some PostgreSQL tables into DataFrames and then bu…

[FIXED] Pyspark - Calculate number of null values in each dataframe column

Issue I have a dataframe with many columns. My aim is to produce a dataframe thats lists each colum…

[FIXED] PySpark - Add a new column with a Rank by User

Issue I have this PySpark DataFrame df = pd.DataFrame(np.array([ ["aa@gmail.com",2,…

[FIXED] Get Last Monday in Spark

Issue I am using Spark 2.0 with the Python API. I have a dataframe with a column of type DateType…

[FIXED] Pyspark DataFrame UDF on Text Column

Issue I'm trying to do some NLP text clean up of some Unicode columns in a PySpark DataFrame. I…

[FIXED] PySpark- How to use a row value from one column to access another column which has the same name as of the row value

Issue I have a PySpark df: +---+---+---+---+---+---+---+---+ | id| a1| b1| c1| d1| e1| f1|ref| +-…

[FIXED] LEFT and RIGHT function in PySpark SQL

Issue I am new for PySpark. I pulled a csv file using pandas. And created a temp table using regist…

[FIXED] Getting OutofMemoryError- GC overhead limit exceed in pyspark

Issue in the middle of project i am getting bellow error after invoking a function in my spark sq…

[FIXED] How to check if array column is inside another column array in PySpark dataframe

Issue Suppose I have the following case from pyspark.sql.types import * schema = StructType([ # …

[FIXED] How to concatenate/append multiple Spark dataframes column wise in Pyspark?

Issue How to do pandas equivalent of pd.concat([df1,df2],axis='columns') using Pyspark data…

[FIXED] I need to append only those who has non null values in pyspark dataframe

Issue I am having the pyspark dataframe (df) having below sample table (table1): id, col1, col2…