小编Har*_*ari的帖子

TypeError:NAType 类型的对象不可 JSON 序列化

预先感谢您的帮助。

我的 python 代码读取 json 输入文件并将数据加载到数据框中,对配置指定的数据框列进行掩码或更改,并在最后阶段创建 json 输出文件。

read json into data frame --> mask/change the df column ---> generate json
Run Code Online (Sandbox Code Playgroud)

输入json:

[
    {
        "BinLogFilename": "mysql.log",
        "Type": "UPDATE",
        "Table": "users",
        "ServerId": 1,
        "BinLogPosition": 2111
    },        {
    {   "BinLogFilename": "mysql.log",
        "Type": "UPDATE",
        "Table": "users",
        "ServerId": null,
        "BinLogPosition": 2111
    },
  ...
]
Run Code Online (Sandbox Code Playgroud)

当我将上述 json 加载到数据框中时,数据框列“ServerId”具有浮点值,因为它在几个 json 输入块中具有 null 。

主要的中央逻辑将“ServerId”转换/伪造为另一个数字,但输出包含浮点数。

输出json:

[
      {
            "BinLogFilename": "mysql.log",
            "Type": "UPDATE",
            "Table": "users",
            "ServerId": 5627.0,
            "BinLogPosition": 2111
        }, 
        {
            "BinLogFilename": "mysql.log",
            "Type": "UPDATE",
            "Table": "users",
            "ServerId": …
Run Code Online (Sandbox Code Playgroud)

python numpy dataframe pandas python-3.8

5
推荐指数
1
解决办法
1万
查看次数

使用CSS在标签文本的右侧显示星号(*)符号

我想使用CSS在标签文本上将星号标记显示到正确的位置,但在vaadin 8.6.2中无法成功

.v-label-wrap {
content: " *";
color: red;
position: absolute;
white-space: normal !important;
word-break: normal !important;
word-wrap: normal !important;
}

Label lblAttr = new Label("Name");
lblAttr.addStyleName("wrap");
Run Code Online (Sandbox Code Playgroud)

需要显示带有红色的星号*。请咨询如何解决这个问题

vaadin vaadin8

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

标签 统计

dataframe ×1

numpy ×1

pandas ×1

python ×1

python-3.8 ×1

vaadin ×1

vaadin8 ×1