看下面的代码:
import pandas as pd
data = pd.read_csv("list.csv")
class_names = data.classname.unique()
for ic in class_names:
print(data['classname' == ic])
在print(data['classname' == ic])
上显示“ KeywordError:False”
但是如果直接给出classname值,它将打印输出,如下所示
print(data['classname'] == 'c1')
可能是什么问题?
答案 0 :(得分:1)
如果要打印与特定类名相关的数据,请尝试:
//here is my retrofit client code
public static Retrofit getClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
if (retrofit != null) {
return retrofit;
}
Gson gson = new GsonBuilder()
.setLenient()
.create();
retrofit = new Retrofit.Builder()
.baseUrl("http://192.168.0.201/")
.addConverterFactory(GsonConverterFactory.create(gson))
.client(client)
.build();
return retrofit;
}
// below is api call
@Multipart
@POST("/~amol/eflbudget/budgetmanagements/test/")
Call<ResponseBody> postMail(
@Part("user_id") RequestBody userId,
@Part("lead_id") RequestBody leadId,
@Part("to") RequestBody to,
@Part("cc_to") RequestBody ccId,
@Part("template_id") RequestBody tempId,
@Part("sender") RequestBody senderId,
@Part("subject") RequestBody subject,
@Part("message") RequestBody message,
@Part MultipartBody.Part file
);
它将返回具有for ic in class_names:
print(data[data['classname'] == ic]])
类名的数据帧
ic
将仅返回布尔序列
答案 1 :(得分:0)
方括号的位置放置在错误的位置。
print(data['classname'] == ic)