CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 12:28:38 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=684ff4009b00cc55240d12e292d2f830f9b53f8eefa37c0ec9f7b5167ce3da16a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22XqkKhqFYxQ2-CEz4Su4igvC2tDRJoHbC%22%3B%7D; HttpOnly; Path=/
cf-ray: 98ce5bc1aa208087-BLR
from pyspark.sql.types import *import pyspark.sql.functions as Fschema = S - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM pyspark.sql.types import *
- import pyspark.sql.functions AS F
- schema = StructType([
- StructField('name', StringType(), nullable=FALSE),
- StructField("business", ArrayType(StringType())),
- StructField('total', IntegerType(), nullable=FALSE)
- ])
- test_list = ['a',['Hello', 'world'],200], ['a',['I', 'am', 'fine'],300],['b',[],500]
- df = spark.createDataFrame(test_list,schema=schema)
- df1=df.groupBy('name','business').agg(F.when(F.size('business')>1,F.SUM('total')/F.size('business')).otherwise(F.SUM('total')).alias('total'))
- df1 = df1.withColumn('business',F.explode_outer('business'))
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐ G2A Bug ⭐ (Get more on BTC swaps) ✅ NEVER S...
JavaScript | 5 sec ago | 0.24 KB
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 6 sec ago | 0.10 KB
-
⭐⭐Exchange Exploit⭐⭐ H
JavaScript | 7 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 3
JavaScript | 12 sec ago | 0.24 KB
-
⭐✅ Jack's Profit Method ✅ NEVER SEEN BEF...
JavaScript | 15 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 16 sec ago | 0.10 KB
-
✅⭐ Make huge profits on trading ⭐⭐ J
JavaScript | 18 sec ago | 0.24 KB
-
⭐✅ Online Marketplace Exploit ✅ NEVER SEEN BE...
JavaScript | 24 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand