我想使用pyspark读取 n 个csv文件。 CSV具有相同的架构,但具有不同的列名。
在读取这些文件时,我想创建一个附加的“管道”列,其中包含第一列名称的子字符串。
我该如何实现?
df = spark.read.format("csv") \
.option("header", True) \
.load(path + "*.csv")
.withColumn("pipeline",
答案 0 :(得分:1)
const controller = async (req, res) => {
const entity = new Entity();
const validation = await entity.validate();
console.log(validation)
};
class Entity{
constructor() {}
async validate() {
return "real function";
}
}
// stub it
let stub = sinon.stub(Entity.prototype, 'validate')
stub.returns('stubbed function')
controller()