我创建了一个spa仅由我的组织拥有的应用程序,但是在我请求代码时出现了问题。我该如何解决?

我有下表:
FN LN LN1 LN2 LN3 LN4 LN5
a b b x x x x
a c b d e NA NA
a d c a b x x
a e b c d x e
Run Code Online (Sandbox Code Playgroud)
我正在过滤LN1到LN5中存在LN的记录.
我用过的代码:
testFilter = filter(test, LN %in% c(LN1, LN2, LN3, LN4, LN5))
Run Code Online (Sandbox Code Playgroud)
结果不是我所期望的:
ï..FN LN LN1 LN2 LN3 LN4 LN5
1 a b b x x x x
2 a c b d e <NA> <NA>
3 a d c a b x x …Run Code Online (Sandbox Code Playgroud) 我有一个场景,数据框列中有 XML 数据。
+-----------+----------+----------+--------------------+----+----------+--------+---+------------------+----------+--------------------+----+
| county|created_at|first_name| id|meta|name_count|position|sex| sid|updated_at| visitors|year|
+-----------+----------+----------+--------------------+----+----------+--------+---+------------------+----------+--------------------+----+
| KINGS|1574264158| ZOEY|00000000-0000-000...| { }| 11| 0| F|row-r9pv-p86t.ifsp|1574264158|<?xml version="1....|2007|
Run Code Online (Sandbox Code Playgroud)
我想Visitors使用 UDF 将嵌套的 XML 字段解析为 Dataframe 中的列
XML 格式 -
<?xml version="1.0" encoding="utf-8"?> <visitors> <visitor id="9615" age="68" sex="F" /> <visitor id="1882" age="34" sex="M" /> <visitor id="5987" age="23" sex="M" /> </visitors>
Run Code Online (Sandbox Code Playgroud) def cast_vector(row):
return np.array(list(map(lambda x: x.astype('float32'), row)))
words = pd.DataFrame(word_vectors.vocab.keys())
words.columns = ['words']
words['vectors'] = words.words.apply(lambda x: word_vectors.wv[f'{x}'])
words['vectors_typed'] = words.vectors.apply(cast_vector)
words['cluster'] = words.vectors_typed.apply(lambda x: model.predict([np.array(x)]))
#words.cluster = words.cluster.apply(lambda x: x[0])
Run Code Online (Sandbox Code Playgroud)
虽然是float32,为什么会出错?

birth_date我有一个以这种格式调用的整数列:20141130
我想将其转换为2014-11-30PySpark 中的内容。
这会错误地转换日期:
.withColumn("birth_date", F.to_date(F.from_unixtime(F.col("birth_date"))))
Run Code Online (Sandbox Code Playgroud)
这给出了一个错误:argument 1 requires (string or date or timestamp) type, however, 'birth_date' is of int type
.withColumn('birth_date', F.to_date(F.unix_timestamp(F.col('birth_date'), 'yyyyMMdd').cast('timestamp')))
Run Code Online (Sandbox Code Playgroud)
将其转换为我想要的日期的最佳方法是什么?
我正在尝试使用 devise bootstrap 视图 gem https://github.com/hisea/devise-bootstrap-views来创建一个应用程序。
这是我所做的:
*= require devise_bootstrap_views到application.css之前的文件中*= require_tree .rails g devise:views:locale enrails g devise:views:bootstrap_templates但是,当我刷新浏览器时,我看到以下错误。我尝试找出错误,但无济于事。
这是错误的屏幕截图:

有人可以告诉我错误是在哪里引起的吗?
我有以下 HTML 组件:
<mat-selection-list #shoes>
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe.title}}
</mat-list-option>
</mat-selection-list>
<pre>
Options selected: {{this.result | json}}
</pre>
Run Code Online (Sandbox Code Playgroud)
这是 ts 组件,它包含一个数组,其中包含发送到 HTML 组件的数据。
ngOnInit() {
this.typesOfShoes = [
{
id: 1,
title: 'Aaa',
checked: true,
},
{
id: 2,
title: 'Bbb',
checked: false,
},
{
id: 3,
title: 'Ccc',
checked: true,
},
{
id: 4,
title: 'Ddd',
checked: false,
},
];
}
Run Code Online (Sandbox Code Playgroud)
我在StackBlitz 中留下了该项目的链接

假设我有一个示例数据框,如下所示:
+-----+----+----+
| col1|col2|col3|
+-----+----+----+
| cat| 10| 1.5|
| dog| 20| 9.0|
| null| 30|null|
|mouse|null|15.3|
+-----+----+----+
Run Code Online (Sandbox Code Playgroud)
我想根据数据类型填充空值。例如,对于字符串类型,我想填充“N/A”,对于整数类型,我想添加 0。同样,对于浮点数,我想添加 0.0。
我尝试使用 df.fillna() 但后来我意识到可能有“N”列,所以我想要一个动态解决方案。