Question: Convert SAS program to python ( Without Pandas ) : DATA test; INPUT prenom :$ 9 . ; CARDS; Mathilde Fr d ric Subira Fr
Convert SAS program to python Without Pandas :
DATA test;
INPUT prenom :$;
CARDS;
Mathilde
Frdric
Subira
Frdric
Subira
Subira
;
PROC SORT DATAtest;
BY prenom;
RUN;
DATA test;
SET TEST;
BY prenom;
xfirst.prenom;
xlast.prenom;
RUN;
Results :
Obs. prenom x x
Frdric
Frdric
Mathilde
Subira
Subira
Subira
This is what I have already been able to do but it is not the desired result :
dftest spark.createDataFrameMathildeFrdric"Subira","Frdric"Subira","Subira" "string"toDFprnom
from pyspark.sql import functions as F Window as W
w WpartitionByprnomorderByprnom
df dftest.withColumnX Frownumberoverw
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
