小编Shi*_*ngh的帖子

创建空数据框的熊猫错误

我尝试制作一个虚拟数据框,

column_names = ["a", "b", "c"]

df = pd.DataFrame(columns = column_names)

我收到以下错误,这以前没有发生过,我是不是遗漏了什么。这仅在创建空数据帧时发生,这是最近引入的错误。

  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 411, in __init__
    mgr = init_dict(data, index, columns, dtype=dtype)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 242, in init_dict
    val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1221, in construct_1d_arraylike_from_scalar
    dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'

Run Code Online (Sandbox Code Playgroud)

示例代码

python dataframe pandas

20
推荐指数
3
解决办法
8262
查看次数

如何通过 Kafka Producer 发送 Protobuf 消息

我正在使用 Sarama 库通过生产者发送消息。这允许我发送字符串。我的目标是发送 Protobuf 消息

msg := &sarama.ProducerMessage{
            Topic: *topic,
            Value: sarama.StringEncoder(content),
        }
Run Code Online (Sandbox Code Playgroud)

这是我拥有的示例原型类

message Pixel {

    // Session identifier stuff
    int64 timestamp    = 1; // Milliseconds from the epoch
    string session_id  = 2; // Unique Identifier... for parent level0top
    string client_name = 3; // Client-name/I-key

    string ip = 10;
    repeated string ip_list = 11;
    string datacenter = 12;
    string proxy_type = 13;

Run Code Online (Sandbox Code Playgroud)

请你给我一个如何发送 protobuf 消息的例子。

go protocol-buffers kafka-producer-api

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

HTML 表格中特定列的边框

如何在 HTML 表格中的列周围添加边框?我们是否使用 colspan 来执行此类函数?

html

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