当前位置:网站首页>Spark dataframe replaces empty characters (or other values) in each column with null
Spark dataframe replaces empty characters (or other values) in each column with null
2022-07-29 03:39:00 【Gun gun gun】
var offlineData: DataFrame = ......
val offlineDataFieldName: Array[String] = offlineData.schema.names
(0 until offlineDataFieldName.length).foreach(idx => {
offlineData = offlineData.withColumn(
offlineDataFieldName.apply(idx)
, when(col(offlineDataFieldName.apply(idx)) === "" or col(offlineDataFieldName.apply(idx)) === " Other values ", lit(null)).otherwise(col(offlineDataFieldName.apply(idx)))
)
})
Reference material :
https://www.thinbug.com/q/44102133
边栏推荐
- Deep into C language (3) -- input and output stream of C
- 深入C语言(4)——switch的定义与使用
- ROS - create workspace
- Web uploader cannot upload multiple files
- The difference between int and integer. Is int or integer used in practical applications?
- AI platform, AI midrange architecture
- Reproduce 20 character short domain name bypass and XSS related knowledge points
- RTP 发送 和接收 h265
- KNN method predicts pregnancy, KNN principle simple code
- Realize multi-level linkage through recursion
猜你喜欢
今晚7:30 | 连界、将门、百度、碧桂园创投四位大佬眼中的AI世界,是继续高深还是回归商业本质?...
How to deploy sentinel cluster of redis
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
【科技1】
暴力递归到动态规划 01 (机器人移动)
(newcoder 15079) irrelevant (inclusion exclusion principle)
for_ Example of each usage
Machine learning [numpy]
The latest second edition of comic novels, listening to books, three in one, complete source code / integrated visa free interface / building tutorials / with acquisition interface
How does DataGrid export and recover the entire database data, using a single SQL file
随机推荐
Set functions in kotlin
力扣每日一题-第44天-205. 同构字符串
Introduction and comparison of unicast, multicast (target broadcast, multicast), broadcast, flooding, flooding
exness:鸽派决议帮助黄金反弹,焦点转向美国GDP
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
1. Header file - Comment - namespace - standard input / output stream
2 neural network toolbox NN
three.js 第五十四用如何给shader传递结构体数组
Instance setup flask service (simple version)
Why do programmers so "dislike" the trunk development mode?
(codeforce547) c-mike and foam
Suffix automata (SAM) board from Jly
Rdkit II: use rdkit screening to screen 2D pharmacophores of chemical small molecules
Microcomputer principle operation
座机的表单验证
Producer consumer model of concurrent model
Why is continuous integration and deployment important in development?
Division and description of military technical documents
Anaconda offline installation environment
I.MX6U-驱动开发-2-LED驱动