本文介绍了当列名包含特殊字符时,as.h2o会产生附加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在列名中包含非ASCII字符的矩阵:

I have a matrix containing non-ascii character in a column name:

df <- replicate(3, rnorm(5)) 
colnames(df) <- c('A', 'B', 'Č')
df

              A          B          Č
[1,]  1.6882234 0.37369538  0.1412783
[2,] -1.4538027 0.37603834 -0.2108820
[3,]  0.2878318 0.52661834 -0.4106152
[4,]  1.0373949 1.41206911  0.5056488
[5,] -2.3852925 0.05160573 -1.1288920

当我运行以下命令时,结果将另外更改行和列的名称:

When I run the following, the result has one additional row and column name changes:

library(h2o)
h2o.init()
df_h2o <- as.h2o(df)
df_h2o

           A          B    "ÄŹĹĽËť
1        NaN        NaN        NaN
2  1.6882234 0.37369538  0.1412783
3 -1.4538027 0.37603834 -0.2108820
4  0.2878318 0.52661834 -0.4106152
5  1.0373949 1.41206911  0.5056488
6 -2.3852925 0.05160573 -1.1288920

[6 rows x 3 columns] 

除了固定输入列名称之外,还有一种优雅的方法可以解决此问题吗?

Is there an elegant way to fix this besides fixing input column names?

推荐答案

我能够在3.16.0.2中复制它;这是一个错误(至少在某些系统上).您可以在此处进行进度.谢谢!

I was able to replicate this in 3.16.0.2; it's a bug (at least on some systems). You can follow the progress here. Thanks!

这篇关于当列名包含特殊字符时,as.h2o会产生附加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 00:56