我在尝试绘制一个时遇到以下错误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]] …
所以我偶然发现了这段代码,我不明白为什么下面的结构不是格式错误的。
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>非病态如何?以上编译没有错误。