Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started