# calculate CTR
count_all = 0
count_4 = 0
for df in pd.read_csv( open("%s/tianchi_fresh_comp_train_user.csv" %
root_path,'r'), chunksize=10000):
try:
count_user = df['behavior_type'].value_counts()
count_all += count_user[1]+count_user[2]+count_user[3]+count_user[4]
count_4 += count_user[4]
except StopIteration:
print("Iteration is stopped.")
# CTR
print(count_all)
print(count_4)
错误信息
但是如果我将chunksize
从10000修改为100000。
chunksize = 100000
,
没关系,没问题
为什么我设置chunksize = 10000
时出错?
答案 0 :(得分:0)
<script>
$("#theimage").hide();
$("#nameofimages").on('click',function(){
$("#theimage").toggle();
});
</script>
@section('content')
@foreach($images as $image)
<p id="nameofimages">{{ $image->imagenames }}</p>
<img id="theimage" src="/images/{{ $image->imagelocation }}">
@endforeach
@endsection
我修改了代码,现在可以,当chunksize = 10000时,没问题。