小编Kos*_*Rim的帖子

Pandas dataframe:ValueError:num必须是1 <= num <= 0,而不是1

我在尝试绘制一个时遇到以下错误pandas dataframe:

ValueError:num必须为1 <= num <= 0,而不是1

码:

import matplotlib.pyplot as plt

names = ['buying', 'maint', 'doors', 'persons', 'lug_boot', 'safety']
custom = pd.DataFrame(x_train)  //only a portion of the csv
custom.columns = names
custom.hist()
plt.show()
Run Code Online (Sandbox Code Playgroud)

我试图再次从该文件读取文件csv,我得到完全相同的错误.

编辑:

print x_train 输出:

[[0.0 0.0 0.0 0.0 0.0 0.0]

[1.0 1.0 0.0 0.0 0.0 0.0]

[0.0 0.0 0.0 0.0 0.0 0.0]

...

[0.0 0.0 0.0 0.0 0.0 0.0]

[0.3333333333333333 0.3333333333333333 2.0 2.0 2.0 2.0]

[0.0 0.0 3.0 3.0 3.0 3.0]] …

python histogram pandas

13
推荐指数
2
解决办法
2万
查看次数

在 std::index_sequence 中没有对包扩展的诊断

所以我偶然发现了这段代码,我不明白为什么下面的结构不是格式错误的。

template<typename T, std::size_t... lst> 
struct mystruct : std::index_sequence<lst..., sizeof...(lst)> { 
  T i; 
};

int main() {
  mystruct<int> obj;
}
Run Code Online (Sandbox Code Playgroud)

这应该是格式错误的,因为使用 T = int 实例化 mystruct 将产生以下类(在 T 替换为 int 之后):

template<int, std::size_t... lst> 
struct mystruct : std::index_sequence<, //Empty list expansion
                                      0> { 
  int i; 
}; 
Run Code Online (Sandbox Code Playgroud)

std::index_sequence<, 0>非病态如何?以上编译没有错误。

c++ c++17

4
推荐指数
1
解决办法
83
查看次数

标签 统计

c++ ×1

c++17 ×1

histogram ×1

pandas ×1

python ×1