我尝试制作一个虚拟数据框,
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)
我正在使用 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 消息的例子。