Questions tagged [pyspark]

The Spark Python API (PySpark) exposes the apache-spark programming model to Python.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

Pyspark install failing on Mac OSX

Not able to run pyspark, spark-shell, apache-spark on my mac after attempting install. At ...
0 votes
0 answers
27 views

what is difference between greatest and max function in spark data frame?

What is the exact difference between greatest and max functions in Spark data frame ,Since it returns the max value in the specified range
0 votes
0 answers
37 views

Spark - Group by coulmn_1, and calculate the precentiles of coulmn_2 where the precentile to calculate is in coulmn_3

I have a data frame with 3 main columns. coulmn_1 - the column I want to preform group by on coulmn_2 - contains numeric values I would like to calculate percentiles on coulmn_3 - contains a number ...
  • 101
1 vote
0 answers
14 views

Find closest item from ALS model using KNN

I have a dataset like: ...
  • 183
0 votes
0 answers
10 views

How do you iterate an entire query based on a condition calculated from the result of the query in Spark/pyspark?

I am writing a pyspark program to iterate an entire query many times. A mix of relational and functional spark transformations get applied to a dataframe and produce another dataframe with exactly the ...
  • 1
0 votes
0 answers
12 views

How does ALS implementation calculate ratings when model.transform is called?

The spark ALS model is based on this paper: Collaborative Filtering for Implicit Feedback datasets. . Here, latent vectors are learnt such that instead of estimating R (ratings matrix), they only ...
0 votes
2 answers
417 views

Exploratory data analysis (EDA) on large dataset

I am working with lots of data (we have a table that produces 30 million rows daily). What is the best way to explore it (do on EDA)? Take a frictional slicing of the data randomly (100000 rows) or ...
  • 35
0 votes
1 answer
132 views

Does one-hot encode effects chi-square test?

I am doing a feature selection for a data science project with one of those feature being a high cardinality categorical variable (for context, it’s nationality). I know chi-square test could handle ...
0 votes
1 answer
10 views

Contunious model update

Hello I have a trained model on credit card fraud detection, however I want to find a solution so I can update the model parameters with new input records to simulate the pattern changes, is there any ...
0 votes
0 answers
78 views

Computing number of business days between start/end columns

I have two Dataframes facts: columns: data, start_date and end_date holidays: column: <...
  • 101
0 votes
0 answers
32 views

PySpark createDataFrame() throws segmentation fault on Mac

I'm trying to learn PySpark. Finally got it installed following the tutorial here: https://sparkbyexamples.com/pyspark/install-pyspark-in-anaconda-jupyter-notebook/ However, even though I am now able ...
0 votes
0 answers
148 views

Is it possible to implement an rdd version of a for loop having map and reduce using pyspark?

I need to test an algorithm that computes a function on a dataframe where in each execution I drop a column and computes the function. This is a example in python pyspark but without using rdd: ...
  • 1
0 votes
0 answers
47 views

Group a spark dataframe by a starting event to an ending event

Given a series of events (with datetime) such as: failed, failed, passed, failed, passed, passed I want to retrieve the time from when it first "failed" to when it first "passed," ...
  • 101
0 votes
0 answers
59 views

Generalized Additive Modeling Apache Spark implementation

Does Spark MLlib support Generalized Additive Modeling? How does one go about implementing GAM models in Spark? I want to implement GAM (Generalized additive model) model in Spark. Based on my ...
  • 1
0 votes
0 answers
17 views

Feature engineering/selection within PySpark CrossValidator

Multiple sources I've read recently have argued that if using cross-validation to assist with model training/tuning, then aspects of the model development process such as feature selection should be ...
  • 1
0 votes
0 answers
15 views

Is model training using spark ML distributed?

Is model training using spark ML distributed? If training happens on a single machine then why use spark?
  • 1
0 votes
1 answer
59 views

CREATE TABLE USING Oracle DATA_SOURCE

I am trying to create a table using ORACLE as a data source using spark query but getting an error. %sql CREATE TABLE TEST USING org.apache.spark.sql.jdbc OPTIONS ( url "jdbc:oracle:thin:@...
0 votes
0 answers
42 views

Pyspark vs Pandas: When should we consider to change from Pandas to Pyspark

We trained a model in a single server using pandas, dataframe = 2.000.000 rows(I run it later in my own laptop), now we are migrating the code to the cloud and in that case to Databricks. In ...
0 votes
0 answers
121 views

Creating table in Databricks using the table from Oracle

I am trying to create a table in Databricks using a object in Oracle Db, but getting an error ...
0 votes
1 answer
17 views

Best approach to find top-k most likely items

I am working with large datasets of papers and authors. I am trying to find top-k authors that are likely to cite a new paper on the unseen dataset (https://www.aminer.org/aminernetwork). My setup is ...
1 vote
0 answers
159 views

Huge matrix multiplication with PySpark

I am currently struggling with a problem. I have been googling around and cannot find an answer. Also I am kinda new to PySpark and Spark maybe that's why I am struggling. Let's say I have a huge $m \...
user avatar
1 vote
1 answer
161 views

How to get dummy variables from "first name"

I intend to predict the age of customers using some features. There are some categorical features that I need to convert to dummy variables before the modelling stage. Since the datasets are so big (...
0 votes
0 answers
10 views

Data Pipelines - Apache Spark - Updating Another Data Store or Input to Queue

What is the correct way to think about or approach something like Spark breaking down a 160GB file into smaller manageable parts, or single records and then doing something like updating records in ...
  • 101
0 votes
0 answers
22 views

How can improve the performance of clustering algorithm concerning similar/same records?

I want to check/experiment efficiency improvement of clustering algorithm under the title of Statistical preprocessing was done by including statistical frequency (counts) into dataframe concerning ...
  • 389
1 vote
1 answer
152 views

PySpark for Big Data and RAM usage

I'm trying to figure out the best and most efficient method of handing ETL operations for big data. My question is this. Say I have a table that is ~50 GB in size. In order to effectively transfer the ...
  • 11
2 votes
1 answer
127 views

Where and how to do large scale supervised machine learning?

I'm beginner in ML and I have a large dataset that has 15 features with 6M rows, so it becomes challenging to work on it locally. I can train one model locally but to perform hyper parameter tuning ...
  • 35
0 votes
1 answer
50 views

ML modeling a data with big amount of rows

I want to do ML modeling such XGboost, KNN, and similar models on data with 9 numerical features and more than 25 million rows and the size of data is almost 2.5 Gig and I prefer to use all the data ...
1 vote
0 answers
37 views

Why do I need to create a dataframe just to add a column? [closed]

So I worked with a bit of pandas and in that, it's easy to add a column to an existing dataframe. But in spark, a new dataframe needs to be created using 'withColumn'. I'm a complete newbie so is ...
1 vote
1 answer
88 views

Pyspark.read from MariaDB fetches duplicate header rows instead of data

It's a very strange issue- instead of fetching data like expected, it returns every row as a duplicate of the header. Every cell is a literal string of the column name. If I don't use the query like ...
0 votes
1 answer
511 views

PySpark Crossvalidation error

I want to do a very simple cross validation using LogisticRegression. Here is my code: ...
  • 103
2 votes
1 answer
135 views

Spark: How to run PCA parallelized? Only one thread used

I use pySpark and set my configuration like following: ...
  • 141
0 votes
0 answers
1k views

multi-label prediction with pySpark

I am new to Spark I am using pyspark to predict a multi label results. I have converted multi labels to binary So my labels will look like this ...
  • 517
1 vote
3 answers
4k views

PicklingError in pyspark (PicklingError: Can't pickle <class '__main__.Person'>: attribute lookup Person on __main__ failed)

I am unable to pickle the below class. I am using data bricks 6.5 ML (includes Apache Spark 2.4.5, Scala 2.11) ...
0 votes
1 answer
33 views

Creating more than one worker nodes for local windows machine [closed]

I am using windows laptop. And I installed apache spark for my laptop. And I try to measure spark performance by changing spark components. because of that I want to create more than one worker nodes ...
2 votes
3 answers
8k views

Remove all columns where the entire column is null

I have a very dirty csv where there are several columns with only null values. I would like to remove them. I am trying to select all columns where the count of null values in the column is not equal ...
  • 123
0 votes
1 answer
217 views

How to run Spark python code in Jupyter Notebook via command prompt

I am trying to import a data frame into spark using Python's pyspark module. For this, I used Jupyter Notebook and executed the code shown in the screenshot below After that I want to run this in CMD ...
1 vote
0 answers
1k views

cannot access hive from spark [closed]

I am trying to install a hadoop + spark + hive cluster. I am using hadoop 3.1.2, spark 2.4.5 (scala 2.11 prebuilt with user-provided hadoop) and hive 2.3.3 (also tried 3.1.2 with the exact same ...
0 votes
1 answer
313 views

Spark/Databricks: GPU does not appear to be utilized for ML regression (cross-validation, prediction) notebook

I have created and attached a notebook to a GPU-enabled Databricks cluster (6.4 ML (includes Apache Spark 2.4.5, GPU, Scala 2.11), EC2 type: p2.xlarge). I have started running the notebook that ...
1 vote
1 answer
205 views

Pyspark Dataframes to Pandas and ML Ops - Parallel Execution Hold?

If I convert a spark dataframe into a pandas dataframe and subsequently apply pandas operations and sklearn models to the dataset in databricks, will the operations from pandas and sklearn be ...
2 votes
3 answers
1k views

Is there a cost associated with converting Koalas dataframe to Spark dataframe?

I know that pandas works "under the hood" with numpy arrays stored in dictionaries. In contrast, Koalas works with the underlying Spark framework. Does that mean that there is no extra cost associated ...
  • 165
1 vote
2 answers
1k views

PySpark: How do I specify dropna axis in PySpark transformation?

I would like to drop columns that contain all null values using dropna(). With Pandas you can do this with setting the keyword argument ...
  • 165
0 votes
1 answer
483 views

How to apply K-Medoids in PySpark?

the pyspark ml library does not provide any clustering methods for K-Medoids. So my question is, how can one apply K-Medoids in a pyspark context?
  • 111
1 vote
0 answers
20 views

Tool/Technology/Framework to process file with 1GB [closed]

I'm new to datascience, but I have the following problem: 1) Read a file of 1GB, which each line is a json object 2) There are two more files, much smaller, which I need to JOIN some data In this ...
0 votes
1 answer
222 views

How to split a CSV into a dataframe without newline

Currently I'm using pyspark to make my df from a csv. However when I take the data in, it puts each element on a new line. Is there any way to keep the elements separate, and keep them on the same ...
  • 109
1 vote
0 answers
475 views

Feature importance using logistic regression in pyspark

I am using logistic regression in PySpark. I have after splitting train and test dataset ...
  • 121
0 votes
1 answer
230 views

Incremental modelling of kmeans in pyspark

I have a large dataset and trained the model with kmeans for the first time. I saved the model and pipeline used . Now again I started collecting data. After sufficient data is collected using old ...
2 votes
1 answer
658 views

Calculating Rank Ordering Error Metric for implicit recommendation

I'm reading Collaborative Filtering for Implicit Feedback Datasets. On page 6 they detail their evaluation strategy, which they define as mean Expected Percentile Ranking with the following formula: $...
  • 1,704
2 votes
1 answer
11k views

How to select multiple columns in a RDD with Spark (pySpark)?

Lets say I have a RDD that has comma delimited data. Each comma delimited value represents the amount of hours slept in the day of a week. So for i.e. [8,7,6,7,8,8,5] How can I manipulate the RDD so ...
  • 123
0 votes
2 answers
154 views

customer segmentation with unbalanced data

I am trying to do a customer segmentation on my transactional data and I am struggling a little bit on the best approach. Since it is an unsupervised model I can throw it to any algorithm and get some ...
0 votes
1 answer
233 views

Which ML method for multiclass (non-binary) text classification should I choose (from SparkML)?

I am working on a quite big dataset that will be processed on the cluster, so this is why I am using PySpark for that purpose. The presentable records of this dataset have a such structure: ...