File size: 334,075 Bytes
3708947
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
message,message_type,message_id,conversation_id
Concatenate elements of a list 'x' of multiple integers to a single integer,instruction,0,0
"```sum(d * 10 ** i for i, d in enumerate(x[::-1]))```",output,1,0
convert a list of integers into a single integer,instruction,0,1
"```r = int(''.join(map(str, x)))```",output,1,1
convert a DateTime string back to a DateTime object of format '%Y-%m-%d %H:%M:%S.%f',instruction,0,2
"```datetime.strptime('2010-11-13 10:33:54.227806', '%Y-%m-%d %H:%M:%S.%f')```",output,1,2
get the average of a list values for each key in dictionary `d`),instruction,0,3
"```[(i, sum(j) / len(j)) for i, j in list(d.items())]```",output,1,3
"zip two lists `[1, 2]` and `[3, 4]` into a list of two tuples containing elements at the same index in each list",instruction,0,4
"```zip([1, 2], [3, 4])```",output,1,4
prepend string 'hello' to all items in list 'a',instruction,0,5
```['hello{0}'.format(i) for i in a]```,output,1,5
regex for repeating words in a string `s`,instruction,0,6
"```re.sub('(?<!\\S)((\\S+)(?:\\s+\\2))(?:\\s+\\2)+(?!\\S)', '\\1', s)```",output,1,6
normalize a pandas dataframe `df` by row,instruction,0,7
"```df.div(df.sum(axis=1), axis=0)```",output,1,7
swap values in a tuple/list inside a list `mylist`,instruction,0,8
"```map(lambda t: (t[1], t[0]), mylist)```",output,1,8
Swap values in a tuple/list in list `mylist`,instruction,0,9
"```[(t[1], t[0]) for t in mylist]```",output,1,9
,instruction,0,10
"```driver.find_element_by_xpath(""//p[@id, 'one']/following-sibling::p"")```",output,1,10
"find all occurrences of the pattern '\\[[^\\]]*\\]|\\([^\\)]*\\)|""[^""]*""|\\S+' within `strs`",instruction,0,11
"```re.findall('\\[[^\\]]*\\]|\\([^\\)]*\\)|""[^""]*""|\\S+', strs)```",output,1,11
"generate the combinations of 3 from a set `{1, 2, 3, 4}`",instruction,0,12
"```print(list(itertools.combinations({1, 2, 3, 4}, 3)))```",output,1,12
"add multiple columns `hour`, `weekday`, `weeknum` to pandas data frame `df` from lambda function `lambdafunc`",instruction,0,13
"```df[['hour', 'weekday', 'weeknum']] = df.apply(lambdafunc, axis=1)```",output,1,13
BeautifulSoup search string 'Elsie' inside tag 'a',instruction,0,14
"```soup.find_all('a', string='Elsie')```",output,1,14
"Convert a datetime object `my_datetime` into readable format `%B %d, %Y`",instruction,0,15
"```my_datetime.strftime('%B %d, %Y')```",output,1,15
parse string `s` to int when string contains a number,instruction,0,16
```int(''.join(c for c in s if c.isdigit()))```,output,1,16
add dictionary `{'class': {'section': 5}}` to key 'Test' of dictionary `dic`,instruction,0,17
```dic['Test'].update({'class': {'section': 5}})```,output,1,17
transforming the string `s` into dictionary,instruction,0,18
"```dict(map(int, x.split(':')) for x in s.split(','))```",output,1,18
,instruction,0,19
"```driver.find_element_by_xpath(""//div[@id='a']//a[@class='click']"")```",output,1,19
"find rows matching `(0,1)` in a 2 dimensional numpy array `vals`",instruction,0,20
"```np.where((vals == (0, 1)).all(axis=1))```",output,1,20
,instruction,0,21
```SomeModel.objects.filter(id=id).delete()```,output,1,21
"build a dictionary containing the conversion of each list in list `[['two', 2], ['one', 1]]` to a key/value pair as its items",instruction,0,22
"```dict([['two', 2], ['one', 1]])```",output,1,22
convert list `l` to dictionary having each two adjacent elements as key/value pair,instruction,0,23
"```dict(zip(l[::2], l[1::2]))```",output,1,23
assign float 9.8 to variable `GRAVITY`,instruction,0,24
```GRAVITY = 9.8```,output,1,24
"separate numbers from characters in string ""30m1000n20m""",instruction,0,25
"```re.findall('(([0-9]+)([A-Z]))', '20M10000N80M')```",output,1,25
separate numbers and characters in string '20M10000N80M',instruction,0,26
"```re.findall('([0-9]+|[A-Z])', '20M10000N80M')```",output,1,26
separate numbers and characters in string '20M10000N80M',instruction,0,27
"```re.findall('([0-9]+)([A-Z])', '20M10000N80M')```",output,1,27
"Get a list of  words from a string `Hello world, my name is...James the 2nd!` removing punctuation",instruction,0,28
"```re.compile('\\w+').findall('Hello world, my name is...James the 2nd!')```",output,1,28
Convert string '03:55' into datetime.time object,instruction,0,29
"```datetime.datetime.strptime('03:55', '%H:%M').time()```",output,1,29
request url 'https://www.reporo.com/' without verifying SSL certificates,instruction,0,30
"```requests.get('https://www.reporo.com/', verify=False)```",output,1,30
Extract values not equal to 0 from numpy array `a`,instruction,0,31
```a[a != 0]```,output,1,31
map two lists `keys` and `values` into a dictionary,instruction,0,32
"```new_dict = {k: v for k, v in zip(keys, values)}```",output,1,32
map two lists `keys` and `values` into a dictionary,instruction,0,33
"```dict((k, v) for k, v in zip(keys, values))```",output,1,33
map two lists `keys` and `values` into a dictionary,instruction,0,34
"```dict([(k, v) for k, v in zip(keys, values)])```",output,1,34
find the string matches within parenthesis from a string `s` using regex,instruction,0,35
"```m = re.search('\\[(\\w+)\\]', s)```",output,1,35
Enable the SO_REUSEADDR socket option in socket object `s` to fix the error `only one usage of each socket address is normally permitted`,instruction,0,36
"```s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)```",output,1,36
append the sum of each tuple pair in the grouped list `list1` and list `list2` elements to list `list3`,instruction,0,37
"```list3 = [(a + b) for a, b in zip(list1, list2)]```",output,1,37
converting hex string `s` to its integer representations,instruction,0,38
```[ord(c) for c in s.decode('hex')]```,output,1,38
sort list `student_tuples` by second element of each tuple in ascending and third element of each tuple in descending,instruction,0,39
"```print(sorted(student_tuples, key=lambda t: (-t[2], t[0])))```",output,1,39
get list of duplicated elements in range of 3,instruction,0,40
"```[y for x in range(3) for y in [x, x]]```",output,1,40
read the contents of the file 'file.txt' into `txt`,instruction,0,41
```txt = open('file.txt').read()```,output,1,41
divide each element in list `myList` by integer `myInt`,instruction,0,42
```myList[:] = [(x / myInt) for x in myList]```,output,1,42
,instruction,0,43
"```""""""Name: {0[person.name]}"""""".format({'person.name': 'Joe'})```",output,1,43
replace white spaces in dataframe `df` with '_',instruction,0,44
"```df.replace(' ', '_', regex=True)```",output,1,44
convert date `my_date` to datetime,instruction,0,45
"```datetime.datetime.combine(my_date, datetime.time.min)```",output,1,45
convert tuple `tst` to string `tst2`,instruction,0,46
```tst2 = str(tst)```,output,1,46
get modified time of file `file`,instruction,0,47
```time.ctime(os.path.getmtime(file))```,output,1,47
get creation time of file `file`,instruction,0,48
```time.ctime(os.path.getctime(file))```,output,1,48
get modification time of file `filename`,instruction,0,49
```t = os.path.getmtime(filename)```,output,1,49
get modification time of file `path`,instruction,0,50
```os.path.getmtime(path)```,output,1,50
get modified time of file `file`,instruction,0,51
```print(('last modified: %s' % time.ctime(os.path.getmtime(file))))```,output,1,51
get the creation time of file `file`,instruction,0,52
```print(('created: %s' % time.ctime(os.path.getctime(file))))```,output,1,52
get the creation time of file `path_to_file`,instruction,0,53
```return os.path.getctime(path_to_file)```,output,1,53
execute os command ''TASKKILL /F /IM firefox.exe'',instruction,0,54
```os.system('TASKKILL /F /IM firefox.exe')```,output,1,54
split string `string` on whitespaces using a generator,instruction,0,55
"```return (x.group(0) for x in re.finditer(""[A-Za-z']+"", string))```",output,1,55
Unpack each value in list `x` to its placeholder '%' in string '%.2f',instruction,0,56
"```"""""", """""".join(['%.2f'] * len(x))```",output,1,56
match regex pattern '(\\d+(\\.\\d+)?)' with string '3434.35353',instruction,0,57
"```print(re.match('(\\d+(\\.\\d+)?)', '3434.35353').group(1))```",output,1,57
replace parentheses and all data within it with empty string '' in column 'name' of dataframe `df`,instruction,0,58
"```df['name'].str.replace('\\(.*\\)', '')```",output,1,58
create a list `result` containing elements form list `list_a` if first element of list `list_a` is in list `list_b`,instruction,0,59
```result = [x for x in list_a if x[0] in list_b]```,output,1,59
"generate all possible string permutations of each two elements in list `['hel', 'lo', 'bye']`",instruction,0,60
"```print([''.join(a) for a in combinations(['hel', 'lo', 'bye'], 2)])```",output,1,60
get a list of items form nested list `li` where third element of each item contains string 'ar',instruction,0,61
```[x for x in li if 'ar' in x[2]]```,output,1,61
Sort lists in the list `unsorted_list` by the element at index 3 of each list,instruction,0,62
```unsorted_list.sort(key=lambda x: x[3])```,output,1,62
Log message 'test' on the root logger.,instruction,0,63
```logging.info('test')```,output,1,63
"Return a subplot axes positioned by the grid definition `1,1,1` using matpotlib",instruction,0,64
"```fig.add_subplot(1, 1, 1)```",output,1,64
Sort dictionary `x` by value in ascending order,instruction,0,65
"```sorted(list(x.items()), key=operator.itemgetter(1))```",output,1,65
Sort dictionary `dict1` by value in ascending order,instruction,0,66
"```sorted(dict1, key=dict1.get)```",output,1,66
Sort dictionary `d` by value in descending order,instruction,0,67
"```sorted(d, key=d.get, reverse=True)```",output,1,67
Sort dictionary `d` by value in ascending order,instruction,0,68
"```sorted(list(d.items()), key=(lambda x: x[1]))```",output,1,68
elementwise product of 3d arrays `A` and `B`,instruction,0,69
"```np.einsum('ijk,ikl->ijl', A, B)```",output,1,69
Print a string `card` with string formatting,instruction,0,70
```print('I have: {0.price}'.format(card))```,output,1,70
Write a comment `# Data for Class A\n` to a file object `f`,instruction,0,71
```f.write('# Data for Class A\n')```,output,1,71
move the last item in list `a` to the beginning,instruction,0,72
```a = a[-1:] + a[:-1]```,output,1,72
Parse DateTime object `datetimevariable` using format '%Y-%m-%d',instruction,0,73
```datetimevariable.strftime('%Y-%m-%d')```,output,1,73
Normalize line ends in a string 'mixed',instruction,0,74
"```mixed.replace('\r\n', '\n').replace('\r', '\n')```",output,1,74
find the real user home directory using python,instruction,0,75
```os.path.expanduser('~user')```,output,1,75
index a list `L` with another list `Idx`,instruction,0,76
```T = [L[i] for i in Idx]```,output,1,76
get a list of words `words` of a file 'myfile',instruction,0,77
```words = open('myfile').read().split()```,output,1,77
Get a list of lists with summing the values of the second element from each list of lists `data`,instruction,0,78
```[[sum([x[1] for x in i])] for i in data]```,output,1,78
summing the second item in a list of lists of lists,instruction,0,79
```[sum([x[1] for x in i]) for i in data]```,output,1,79
sort objects in `Articles` in descending order of counts of `likes`,instruction,0,80
```Article.objects.annotate(like_count=Count('likes')).order_by('-like_count')```,output,1,80
return a DateTime object with the current UTC date,instruction,0,81
```today = datetime.datetime.utcnow().date()```,output,1,81
create a list containing the multiplication of each elements at the same index of list `lista` and list `listb`,instruction,0,82
"```[(a * b) for a, b in zip(lista, listb)]```",output,1,82
fetch smilies matching regex pattern '(?::|;|=)(?:-)?(?:\\)|\\(|D|P)' in string `s`,instruction,0,83
"```re.findall('(?::|;|=)(?:-)?(?:\\)|\\(|D|P)', s)```",output,1,83
match the pattern '[:;][)(](?![)(])' to the string `str`,instruction,0,84
"```re.match('[:;][)(](?![)(])', str)```",output,1,84
convert a list of objects `list_name` to json string `json_string`,instruction,0,85
```json_string = json.dumps([ob.__dict__ for ob in list_name])```,output,1,85
create a list `listofzeros` of `n` zeros,instruction,0,86
```listofzeros = [0] * n```,output,1,86
decode the string 'stringnamehere'  to UTF-8,instruction,0,87
"```stringnamehere.decode('utf-8', 'ignore')```",output,1,87
Match regex pattern '((?:A|B|C)D)' on string 'BDE',instruction,0,88
"```re.findall('((?:A|B|C)D)', 'BDE')```",output,1,88
Create a key `key` if it does not exist in dict `dic` and append element `value` to value.,instruction,0,89
"```dic.setdefault(key, []).append(value)```",output,1,89
Get the value of the minimum element in the second column of array `a`,instruction,0,90
"```a[np.argmin(a[:, (1)])]```",output,1,90
extend dictionary `a` with key/value pairs of dictionary `b`,instruction,0,91
```a.update(b)```,output,1,91
removing key values pairs with key 'mykey1' from a list of dictionaries `mylist`,instruction,0,92
"```[{k: v for k, v in d.items() if k != 'mykey1'} for d in mylist]```",output,1,92
,instruction,0,93
"```[dict((k, v) for k, v in d.items() if k != 'mykey1') for d in mylist]```",output,1,93
create 3 by 3 matrix of random numbers,instruction,0,94
"```numpy.random.random((3, 3))```",output,1,94
make new column 'C' in panda dataframe by adding values from other columns 'A' and 'B',instruction,0,95
```df['C'] = df['A'] + df['B']```,output,1,95
create a list of values from the dictionary `programs` that have a key with a case insensitive match to 'new york',instruction,0,96
"```[value for key, value in list(programs.items()) if 'new york' in key.lower()]```",output,1,96
append a path `/path/to/main_folder` in system path,instruction,0,97
```sys.path.append('/path/to/main_folder')```,output,1,97
get all digits in a string `s` after a '[' character,instruction,0,98
"```re.findall('\\d+(?=[^[]+$)', s)```",output,1,98
python pickle/unpickle a list to/from a file 'afile',instruction,0,99
"```pickle.load(open('afile', 'rb'))```",output,1,99
,instruction,0,100
```driver.find_element_by_xpath('xpath').click()```,output,1,100
count unique index values in column 'A' in pandas dataframe `ex`,instruction,0,101
```ex.groupby(level='A').agg(lambda x: x.index.get_level_values(1).nunique())```,output,1,101
Create a pandas dataframe of values from a dictionary `d` which contains dictionaries of dictionaries,instruction,0,102
"```pd.concat(map(pd.DataFrame, iter(d.values())), keys=list(d.keys())).stack().unstack(0)```",output,1,102
find out the number of non-matched elements at the same index of list `a` and list `b`,instruction,0,103
"```sum(1 for i, j in zip(a, b) if i != j)```",output,1,103
make all keys lowercase in dictionary `d`,instruction,0,104
"```d = {(a.lower(), b): v for (a, b), v in list(d.items())}```",output,1,104
sort list `list_` based on first element of each tuple and by the length of the second element of each tuple,instruction,0,105
"```list_.sort(key=lambda x: [x[0], len(x[1]), x[1]])```",output,1,105
trim whitespace in string `s`,instruction,0,106
```s.strip()```,output,1,106
trim whitespace (including tabs) in `s` on the left side,instruction,0,107
```s = s.lstrip()```,output,1,107
trim whitespace (including tabs) in `s` on the right side,instruction,0,108
```s = s.rstrip()```,output,1,108
trim characters ' \t\n\r' in `s`,instruction,0,109
```s = s.strip(' \t\n\r')```,output,1,109
trim whitespaces (including tabs) in string `s`,instruction,0,110
"```print(re.sub('[\\s+]', '', s))```",output,1,110
"In Django, filter `Task.objects` based on all entities in ['A', 'P', 'F']",instruction,0,111
"```Task.objects.exclude(prerequisites__status__in=['A', 'P', 'F'])```",output,1,111
Change background color in Tkinter,instruction,0,112
```root.configure(background='black')```,output,1,112
convert dict `result` to numpy structured array,instruction,0,113
"```numpy.array([(key, val) for key, val in result.items()], dtype)```",output,1,113
Concatenate dataframe `df_1` to dataframe `df_2` sorted by values of the column 'y',instruction,0,114
"```pd.concat([df_1, df_2.sort_values('y')])```",output,1,114
replace the last occurence of an expression '</div>' with '</bad>' in a string `s`,instruction,0,115
"```re.sub('(.*)</div>', '\\1</bad>', s)```",output,1,115
get the maximum of 'salary' and 'bonus' values in a dictionary,instruction,0,116
"```print(max(d, key=lambda x: (d[x]['salary'], d[x]['bonus'])))```",output,1,116
Filter Django objects by `author` with ids `1` and `2`,instruction,0,117
```Book.objects.filter(author__id=1).filter(author__id=2)```,output,1,117
split string 'fooxyzbar' based on case-insensitive matching using string 'XYZ',instruction,0,118
"```re.compile('XYZ', re.IGNORECASE).split('fooxyzbar')```",output,1,118
get list of sums of neighboring integers in string `example`,instruction,0,119
"```[sum(map(int, s)) for s in example.split()]```",output,1,119
Get all the keys from dictionary `y` whose value is `1`,instruction,0,120
```[i for i in y if y[i] == 1]```,output,1,120
converting byte string `c` in unicode string,instruction,0,121
```c.decode('unicode_escape')```,output,1,121
unpivot first 2 columns into new columns 'year' and 'value' from a pandas dataframe `x`,instruction,0,122
"```pd.melt(x, id_vars=['farm', 'fruit'], var_name='year', value_name='value')```",output,1,122
"add key ""item3"" and value ""3"" to dictionary `default_data `",instruction,0,123
```default_data['item3'] = 3```,output,1,123
"add key ""item3"" and value ""3"" to dictionary `default_data `",instruction,0,124
"```default_data.update({'item3': 3, })```",output,1,124
"add key value pairs 'item4' , 4 and 'item5' , 5 to dictionary `default_data`",instruction,0,125
"```default_data.update({'item4': 4, 'item5': 5, })```",output,1,125
Get the first and last 3 elements of list `l`,instruction,0,126
```l[:3] + l[-3:]```,output,1,126
reset index to default in dataframe `df`,instruction,0,127
```df = df.reset_index(drop=True)```,output,1,127
"For each index `x` from 0 to 3, append the element at index `x` of list `b` to the list at index `x` of list a.",instruction,0,128
```[a[x].append(b[x]) for x in range(3)]```,output,1,128
get canonical path of the filename `path`,instruction,0,129
```os.path.realpath(path)```,output,1,129
check if dictionary `L[0].f.items()` is in dictionary `a3.f.items()`,instruction,0,130
```set(L[0].f.items()).issubset(set(a3.f.items()))```,output,1,130
find all the indexes in a Numpy 2D array where the value is 1,instruction,0,131
```zip(*np.where(a == 1))```,output,1,131
,instruction,0,132
```np.where(a == 1)```,output,1,132
Collapse hierarchical column index to level 0 in dataframe `df`,instruction,0,133
```df.columns = df.columns.get_level_values(0)```,output,1,133
"create a matrix from a list `[1, 2, 3]`",instruction,0,134
"```x = scipy.matrix([1, 2, 3]).transpose()```",output,1,134
add character '@' after word 'get' in string `text`,instruction,0,135
"```text = re.sub('(\\bget\\b)', '\\1@', text)```",output,1,135
get a numpy array that contains the element wise minimum of three 3x1 arrays,instruction,0,136
"```np.array([np.arange(3), np.arange(2, -1, -1), np.ones((3,))]).min(axis=0)```",output,1,136
add a column 'new_col' to dataframe `df` for index in range,instruction,0,137
"```df['new_col'] = list(range(1, len(df) + 1))```",output,1,137
set environment variable 'DEBUSSY' equal to 1,instruction,0,138
```os.environ['DEBUSSY'] = '1'```,output,1,138
Get a environment variable `DEBUSSY`,instruction,0,139
```print(os.environ['DEBUSSY'])```,output,1,139
set environment variable 'DEBUSSY' to '1',instruction,0,140
```os.environ['DEBUSSY'] = '1'```,output,1,140
"update dictionary `b`, overwriting values where keys are identical, with contents of dictionary `d`",instruction,0,141
```b.update(d)```,output,1,141
get all the values in column `b` from pandas data frame `df`,instruction,0,142
```df['b']```,output,1,142
"make a line plot with errorbars, `ebar`, from data `x, y, err` and set color of the errorbars to `y` (yellow)",instruction,0,143
"```ebar = plt.errorbar(x, y, yerr=err, ecolor='y')```",output,1,143
find all files with extension '.c' in directory `folder`,instruction,0,144
```results += [each for each in os.listdir(folder) if each.endswith('.c')]```,output,1,144
add unicode string '1' to UTF-8 decoded string '\xc2\xa3',instruction,0,145
```print('\xc2\xa3'.decode('utf8') + '1')```,output,1,145
lower-case the string obtained by replacing the occurrences of regex pattern '(?<=[a-z])([A-Z])' in string `s` with eplacement '-\\1',instruction,0,146
"```re.sub('(?<=[a-z])([A-Z])', '-\\1', s).lower()```",output,1,146
,instruction,0,147
```os.system('ulimit -s unlimited; some_executable')```,output,1,147
format a string `num` using string formatting,instruction,0,148
"```""""""{0:.3g}"""""".format(num)```",output,1,148
append the first element of array `a` to array `a`,instruction,0,149
"```numpy.append(a, a[0])```",output,1,149
return the column for value 38.15 in dataframe `df`,instruction,0,150
"```df.ix[:, (df.loc[0] == 38.15)].columns```",output,1,150
merge 2 dataframes `df1` and `df2` with same values in a column 'revenue' with and index 'date',instruction,0,151
```df2['revenue'] = df2.CET.map(df1.set_index('date')['revenue'])```,output,1,151
load a json data `json_string` into variable `json_data`,instruction,0,152
```json_data = json.loads(json_string)```,output,1,152
convert radians 1 to degrees,instruction,0,153
```math.cos(math.radians(1))```,output,1,153
count the number of integers in list `a`,instruction,0,154
"```sum(isinstance(x, int) for x in a)```",output,1,154
replacing  '\u200b' with '*' in a string  using regular expressions,instruction,0,155
"```'used\u200b'.replace('\u200b', '*')```",output,1,155
run function 'SudsMove' simultaneously,instruction,0,156
```threading.Thread(target=SudsMove).start()```,output,1,156
sum of squares values in a list `l`,instruction,0,157
```sum(i * i for i in l)```,output,1,157
calculate the sum of the squares of each value in list `l`,instruction,0,158
"```sum(map(lambda x: x * x, l))```",output,1,158
Create a dictionary `d` from list `iterable`,instruction,0,159
"```d = dict(((key, value) for (key, value) in iterable))```",output,1,159
Create a dictionary `d` from list `iterable`,instruction,0,160
"```d = {key: value for (key, value) in iterable}```",output,1,160
Create a dictionary `d` from list of key value pairs `iterable`,instruction,0,161
"```d = {k: v for (k, v) in iterable}```",output,1,161
"round off entries in dataframe `df` column `Alabama_exp` to two decimal places, and entries in column `Credit_exp` to three decimal places",instruction,0,162
"```df.round({'Alabama_exp': 2, 'Credit_exp': 3})```",output,1,162
Make function `WRITEFUNCTION` output nothing in curl `p`,instruction,0,163
"```p.setopt(pycurl.WRITEFUNCTION, lambda x: None)```",output,1,163
return a random word from a word list 'words',instruction,0,164
```print(random.choice(words))```,output,1,164
Find a max value of the key `count` in a nested dictionary `d`,instruction,0,165
"```max(d, key=lambda x: d[x]['count'])```",output,1,165
"get list of string elements in string `data` delimited by commas, putting `0` in place of empty strings",instruction,0,166
"```[(int(x) if x else 0) for x in data.split(',')]```",output,1,166
"split string `s` into a list of strings based on ',' then replace empty strings with zero",instruction,0,167
"```"""""","""""".join(x or '0' for x in s.split(','))```",output,1,167
regular expression match nothing,instruction,0,168
```re.compile('$^')```,output,1,168
regular expression syntax for not to match anything,instruction,0,169
```re.compile('.\\A|.\\A*|.\\A+')```,output,1,169
create a regular expression object with a pattern that will match nothing,instruction,0,170
```re.compile('a^')```,output,1,170
drop all columns in dataframe `df` that holds a maximum value bigger than 0,instruction,0,171
```df.columns[df.max() > 0]```,output,1,171
check if date `yourdatetime` is equal to today's date,instruction,0,172
```yourdatetime.date() == datetime.today().date()```,output,1,172
print bold text 'Hello',instruction,0,173
```print('\x1b[1m' + 'Hello')```,output,1,173
remove 20 symbols in front of '.' in string 'unique12345678901234567890.mkv',instruction,0,174
"```re.sub('.{20}(.mkv)', '\\1', 'unique12345678901234567890.mkv')```",output,1,174
"Define a list with string values `['a', 'c', 'b', 'obj']`",instruction,0,175
"```['a', 'c', 'b', 'obj']```",output,1,175
substitute multiple whitespace with single whitespace in string `mystring`,instruction,0,176
"```"""""" """""".join(mystring.split())```",output,1,176
print a floating point number 2.345e-67 without any truncation,instruction,0,177
```print('{:.100f}'.format(2.345e-67))```,output,1,177
Check if key 'key1' in `dict`,instruction,0,178
```('key1' in dict)```,output,1,178
Check if key 'a' in `d`,instruction,0,179
```('a' in d)```,output,1,179
Check if key 'c' in `d`,instruction,0,180
```('c' in d)```,output,1,180
Check if a given key 'key1' exists in dictionary `dict`,instruction,0,181
"```if ('key1' in dict):
    pass```",output,1,181
Check if a given key `key` exists in dictionary `d`,instruction,0,182
"```if (key in d):
    pass```",output,1,182
"create a django query for a list of values `1, 4, 7`",instruction,0,183
"```Blog.objects.filter(pk__in=[1, 4, 7])```",output,1,183
read a binary file 'test/test.pdf',instruction,0,184
"```f = open('test/test.pdf', 'rb')```",output,1,184
"insert ' ' between every three digit before '.' and replace ',' with '.' in 12345678.46",instruction,0,185
"```format(12345678.46, ',').replace(',', ' ').replace('.', ',')```",output,1,185
Join pandas data frame `frame_1` and `frame_2` with left join by `county_ID` and right join by `countyid`,instruction,0,186
"```pd.merge(frame_1, frame_2, left_on='county_ID', right_on='countyid')```",output,1,186
calculate ratio of sparsity in a numpy array `a`,instruction,0,187
```np.isnan(a).sum() / np.prod(a.shape)```,output,1,187
reverse sort items in default dictionary `cityPopulation` by the third item in each key's list of values,instruction,0,188
"```sorted(iter(cityPopulation.items()), key=lambda k_v: k_v[1][2], reverse=True)```",output,1,188
Sort dictionary `u` in ascending order based on second elements of its values,instruction,0,189
"```sorted(list(u.items()), key=lambda v: v[1])```",output,1,189
reverse sort dictionary `d` based on its values,instruction,0,190
"```sorted(list(d.items()), key=lambda k_v: k_v[1], reverse=True)```",output,1,190
sorting a defaultdict `d` by value,instruction,0,191
"```sorted(list(d.items()), key=lambda k_v: k_v[1])```",output,1,191
open a file 'bundled-resource.jpg' in the same directory as a python script,instruction,0,192
"```f = open(os.path.join(__location__, 'bundled-resource.jpg'))```",output,1,192
open the file 'words.txt' in 'rU' mode,instruction,0,193
"```f = open('words.txt', 'rU')```",output,1,193
divide the values with same keys of two dictionary `d1` and `d2`,instruction,0,194
```{k: (float(d2[k]) / d1[k]) for k in d2}```,output,1,194
divide the value for each key `k` in dict `d2` by the value for the same key `k` in dict `d1`,instruction,0,195
```{k: (d2[k] / d1[k]) for k in list(d1.keys()) & d2}```,output,1,195
divide values associated with each key in dictionary `d1` from values associated with the same key in dictionary `d2`,instruction,0,196
"```dict((k, float(d2[k]) / d1[k]) for k in d2)```",output,1,196
write dataframe `df` to csv file `filename` with dates formatted as yearmonthday  `%Y%m%d`,instruction,0,197
"```df.to_csv(filename, date_format='%Y%m%d')```",output,1,197
remove a key 'key' from a dictionary `my_dict`,instruction,0,198
"```my_dict.pop('key', None)```",output,1,198
replace NaN values in array `a` with zeros,instruction,0,199
"```b = np.where(np.isnan(a), 0, a)```",output,1,199
subprocess run command 'start command -flags arguments' through the shell,instruction,0,200
"```subprocess.call('start command -flags arguments', shell=True)```",output,1,200
run command 'command -flags arguments &' on command line tools as separate processes,instruction,0,201
"```subprocess.call('command -flags arguments &', shell=True)```",output,1,201
replace percent-encoded code in request `f` to their single-character equivalent,instruction,0,202
"```f = urllib.request.urlopen(url, urllib.parse.unquote(urllib.parse.urlencode(params)))```",output,1,202
"remove white spaces from the end of string ""    xyz     """,instruction,0,203
"```""""""    xyz     """""".rstrip()```",output,1,203
Replace special characters in utf-8 encoded string `s` using the %xx escape,instruction,0,204
```urllib.parse.quote(s.encode('utf-8'))```,output,1,204
,instruction,0,205
```urllib.parse.quote_plus('a b')```,output,1,205
Create an array containing the conversion of string '100110' into separate elements,instruction,0,206
"```np.array(map(int, '100110'))```",output,1,206
convert a string 'mystr' to numpy array of integer values,instruction,0,207
"```print(np.array(list(mystr), dtype=int))```",output,1,207
convert an rgb image 'messi5.jpg' into grayscale `img`,instruction,0,208
"```img = cv2.imread('messi5.jpg', 0)```",output,1,208
sort list `lst` in descending order based on the second item of each tuple in it,instruction,0,209
"```lst.sort(key=lambda x: x[2], reverse=True)```",output,1,209
,instruction,0,210
"```indices = [i for i, x in enumerate(my_list) if x == 'whatever']```",output,1,210
execute shell command 'grep -r PASSED *.log | sort -u | wc -l' with a | pipe in it,instruction,0,211
"```subprocess.call('grep -r PASSED *.log | sort -u | wc -l', shell=True)```",output,1,211
count the number of trailing question marks in string `my_text`,instruction,0,212
```len(my_text) - len(my_text.rstrip('?'))```,output,1,212
remove dollar sign '$' from second to last column data in dataframe 'df' and convert the data into floats,instruction,0,213
"```df[df.columns[1:]].replace('[\\$,]', '', regex=True).astype(float)```",output,1,213
Merge column  'word' in dataframe `df2` with column 'word' on dataframe `df1`,instruction,0,214
"```df1.merge(df2, how='left', on='word')```",output,1,214
switch positions of each two adjacent characters in string `a`,instruction,0,215
"```print(''.join(''.join(i) for i in zip(a2, a1)) + a[-1] if len(a) % 2 else '')```",output,1,215
make a window `root` jump to the front,instruction,0,216
"```root.attributes('-topmost', True)```",output,1,216
make a window `root` jump to the front,instruction,0,217
```root.lift()```,output,1,217
Convert list of booleans `walls` into a hex string,instruction,0,218
"```hex(int(''.join([str(int(b)) for b in walls]), 2))```",output,1,218
convert the sum of list `walls` into a hex presentation,instruction,0,219
"```hex(sum(b << i for i, b in enumerate(reversed(walls))))```",output,1,219
"print the string `Total score for`, the value of the variable `name`, the string `is` and the value of the variable `score` in one print call.",instruction,0,220
"```print(('Total score for', name, 'is', score))```",output,1,220
print multiple arguments 'name' and 'score'.,instruction,0,221
"```print('Total score for {} is {}'.format(name, score))```",output,1,221
print a string using multiple strings `name` and `score`,instruction,0,222
"```print('Total score for %s is %s  ' % (name, score))```",output,1,222
print string including multiple variables `name` and `score`,instruction,0,223
"```print(('Total score for', name, 'is', score))```",output,1,223
serve a static html page 'your_template.html' at the root of a django project,instruction,0,224
"```url('^$', TemplateView.as_view(template_name='your_template.html'))```",output,1,224
"use a list of values `[3,6]` to select rows from a pandas dataframe `df`'s column 'A'",instruction,0,225
"```df[df['A'].isin([3, 6])]```",output,1,225
,instruction,0,226
```instance.__class__.__name__```,output,1,226
execute python code `myscript.py` in a virtualenv `/path/to/my/venv` from matlab,instruction,0,227
```system('/path/to/my/venv/bin/python myscript.py')```,output,1,227
django return a QuerySet list containing the values of field 'eng_name' in model `Employees`,instruction,0,228
"```Employees.objects.values_list('eng_name', flat=True)```",output,1,228
"find all digits in string '6,7)' and put them to a list",instruction,0,229
"```re.findall('\\d|\\d,\\d\\)', '6,7)')```",output,1,229
prompt string 'Press Enter to continue...' to the console,instruction,0,230
```input('Press Enter to continue...')```,output,1,230
"print string ""ABC"" as hex literal",instruction,0,231
"```""""""ABC"""""".encode('hex')```",output,1,231
insert a new field 'geolocCountry' on an existing document  'b' using pymongo,instruction,0,232
"```db.Doc.update({'_id': b['_id']}, {'$set': {'geolocCountry': myGeolocCountry}})```",output,1,232
Write a regex statement to match 'lol' to 'lolllll'.,instruction,0,233
"```re.sub('l+', 'l', 'lollll')```",output,1,233
BeautifulSoup find all 'tr' elements in HTML string `soup` at the five stride starting from the fourth element,instruction,0,234
```rows = soup.findAll('tr')[4::5]```,output,1,234
reverse all x-axis points in pyplot,instruction,0,235
```plt.gca().invert_xaxis()```,output,1,235
reverse y-axis in pyplot,instruction,0,236
```plt.gca().invert_yaxis()```,output,1,236
stack two dataframes next to each other in pandas,instruction,0,237
"```pd.concat([GOOG, AAPL], keys=['GOOG', 'AAPL'], axis=1)```",output,1,237
create a json response `response_data`,instruction,0,238
"```return HttpResponse(json.dumps(response_data), content_type='application/json')```",output,1,238
decode escape sequences in string `myString`,instruction,0,239
```myString.decode('string_escape')```,output,1,239
calculate the md5 checksum of a file named  'filename.exe',instruction,0,240
"```hashlib.md5(open('filename.exe', 'rb').read()).hexdigest()```",output,1,240
Find all keys from a dictionary `d` whose values are `desired_value`,instruction,0,241
"```[k for k, v in d.items() if v == desired_value]```",output,1,241
create a set containing all keys' names from dictionary `LoD`,instruction,0,242
```{k for d in LoD for k in list(d.keys())}```,output,1,242
create a set containing all keys names from list of dictionaries `LoD`,instruction,0,243
```set([i for s in [list(d.keys()) for d in LoD] for i in s])```,output,1,243
extract all keys from a list of dictionaries `LoD`,instruction,0,244
```[i for s in [list(d.keys()) for d in LoD] for i in s]```,output,1,244
unpack keys and values of a dictionary `d` into two lists,instruction,0,245
"```keys, values = zip(*list(d.items()))```",output,1,245
convert a string `s` containing a decimal to an integer,instruction,0,246
```int(Decimal(s))```,output,1,246
,instruction,0,247
```int(s.split('.')[0])```,output,1,247
check if array `b` contains all elements of array `a`,instruction,0,248
"```numpy.in1d(b, a).all()```",output,1,248
numpy:  check if array 'a' contains all the numbers in array 'b'.,instruction,0,249
```numpy.array([(x in a) for x in b])```,output,1,249
Draw node labels `labels` on networkx graph `G ` at position `pos`,instruction,0,250
"```networkx.draw_networkx_labels(G, pos, labels)```",output,1,250
make a row-by-row copy `y` of array `x`,instruction,0,251
```y = [row[:] for row in x]```,output,1,251
Create 2D numpy array from the data provided in 'somefile.csv' with each row in the file having same number of values,instruction,0,252
"```X = numpy.loadtxt('somefile.csv', delimiter=',')```",output,1,252
get a list of items from the list `some_list` that contain string 'abc',instruction,0,253
```matching = [s for s in some_list if 'abc' in s]```,output,1,253
export a pandas data frame `df` to a file `mydf.tsv` and retain the indices,instruction,0,254
"```df.to_csv('mydf.tsv', sep='\t')```",output,1,254
,instruction,0,255
"```random.sample(list(range(100)), 10)```",output,1,255
split a string `s` on last delimiter,instruction,0,256
"```s.rsplit(',', 1)```",output,1,256
Check if all elements in list `lst` are tupples of long and int,instruction,0,257
"```all(isinstance(x, int) for x in lst)```",output,1,257
check if all elements in a list 'lst' are the same type 'int',instruction,0,258
"```all(isinstance(x, int) for x in lst)```",output,1,258
strip a string `line` of all carriage returns and newlines,instruction,0,259
```line.strip()```,output,1,259
scroll to the bottom of a web page using selenium webdriver,instruction,0,260
"```driver.execute_script('window.scrollTo(0, Y)')```",output,1,260
scroll a to the bottom of a web page using selenium webdriver,instruction,0,261
"```driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')```",output,1,261
convert Date object `dateobject` into a DateTime object,instruction,0,262
"```datetime.datetime.combine(dateobject, datetime.time())```",output,1,262
check if any item from list `b` is in list `a`,instruction,0,263
```print(any(x in a for x in b))```,output,1,263
save a numpy array `image_array` as an image 'outfile.jpg',instruction,0,264
"```scipy.misc.imsave('outfile.jpg', image_array)```",output,1,264
Remove anything in parenthesis from string `item` with a regex,instruction,0,265
"```item = re.sub(' ?\\([^)]+\\)', '', item)```",output,1,265
Remove word characters in parenthesis from string `item` with a regex,instruction,0,266
"```item = re.sub(' ?\\(\\w+\\)', '', item)```",output,1,266
Remove all data inside parenthesis in string `item`,instruction,0,267
"```item = re.sub(' \\(\\w+\\)', '', item)```",output,1,267
check if any elements in one list `list1` are in another list `list2`,instruction,0,268
```len(set(list1).intersection(list2)) > 0```,output,1,268
convert hex string `s` to decimal,instruction,0,269
"```i = int(s, 16)```",output,1,269
"convert hex string ""0xff"" to decimal",instruction,0,270
"```int('0xff', 16)```",output,1,270
"convert hex string ""FFFF"" to decimal",instruction,0,271
"```int('FFFF', 16)```",output,1,271
convert hex string '0xdeadbeef' to decimal,instruction,0,272
```ast.literal_eval('0xdeadbeef')```,output,1,272
convert hex string 'deadbeef' to decimal,instruction,0,273
"```int('deadbeef', 16)```",output,1,273
take screenshot 'screen.png' on mac os x,instruction,0,274
```os.system('screencapture screen.png')```,output,1,274
"Set a window size to `1400, 1000` using selenium webdriver",instruction,0,275
"```driver.set_window_size(1400, 1000)```",output,1,275
replace non-ascii chars from a unicode string u'm\xfasica',instruction,0,276
"```unicodedata.normalize('NFKD', 'm\xfasica').encode('ascii', 'ignore')```",output,1,276
concatenate dataframe `df1` with `df2` whilst removing duplicates,instruction,0,277
"```pandas.concat([df1, df2]).drop_duplicates().reset_index(drop=True)```",output,1,277
Construct an array with data type float32 `a` from data in binary file 'filename',instruction,0,278
"```a = numpy.fromfile('filename', dtype=numpy.float32)```",output,1,278
execute a mv command `mv /home/somedir/subdir/* somedir/` in subprocess,instruction,0,279
"```subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True)```",output,1,279
,instruction,0,280
"```subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True)```",output,1,280
print a character that has unicode value `\u25b2`,instruction,0,281
```print('\u25b2'.encode('utf-8'))```,output,1,281
compare contents  at filehandles `file1` and `file2` using difflib,instruction,0,282
"```difflib.SequenceMatcher(None, file1.read(), file2.read())```",output,1,282
"Create a dictionary from string `e` separated by `-` and `,`",instruction,0,283
"```dict((k, int(v)) for k, v in (e.split(' - ') for e in s.split(',')))```",output,1,283
"check if all elements in a tuple `(1, 6)` are in another `(1, 2, 3, 4, 5)`",instruction,0,284
"```all(i in (1, 2, 3, 4, 5) for i in (1, 6))```",output,1,284
extract unique dates from time series 'Date' in dataframe `df`,instruction,0,285
```df['Date'].map(lambda t: t.date()).unique()```,output,1,285
right align string `mystring` with a width of 7,instruction,0,286
"```""""""{:>7s}"""""".format(mystring)```",output,1,286
read an excel file 'ComponentReport-DJI.xls',instruction,0,287
"```open('ComponentReport-DJI.xls', 'rb').read(200)```",output,1,287
sort dataframe `df` based on column 'b' in ascending and column 'c' in descending,instruction,0,288
"```df.sort_values(['b', 'c'], ascending=[True, False], inplace=True)```",output,1,288
sort dataframe `df` based on column 'a' in ascending and column 'b' in descending,instruction,0,289
"```df.sort_values(['a', 'b'], ascending=[True, False])```",output,1,289
sort a pandas data frame with column `a` in ascending and `b` in descending order,instruction,0,290
"```df1.sort(['a', 'b'], ascending=[True, False], inplace=True)```",output,1,290
"sort a pandas data frame by column `a` in ascending, and by column `b` in descending order",instruction,0,291
"```df.sort(['a', 'b'], ascending=[True, False])```",output,1,291
django redirect to view 'Home.views.index',instruction,0,292
```redirect('Home.views.index')```,output,1,292
"remove all values within one list `[2, 3, 7]` from another list `a`",instruction,0,293
"```[x for x in a if x not in [2, 3, 7]]```",output,1,293
"remove the punctuation '!', '.', ':' from a string `asking`",instruction,0,294
"```out = ''.join(c for c in asking if c not in ('!', '.', ':'))```",output,1,294
BeautifulSoup get value associated with attribute 'content' where attribute 'name' is equal to 'City' in tag 'meta' in HTML parsed string `soup`,instruction,0,295
"```soup.find('meta', {'name': 'City'})['content']```",output,1,295
unquote a urlencoded unicode string '%0a',instruction,0,296
```urllib.parse.unquote('%0a')```,output,1,296
decode url `url` from UTF-16 code to UTF-8 code,instruction,0,297
```urllib.parse.unquote(url).decode('utf8')```,output,1,297
empty a list `lst`,instruction,0,298
```del lst[:]```,output,1,298
empty a list `lst`,instruction,0,299
```del lst1[:]```,output,1,299
empty a list `lst`,instruction,0,300
```lst[:] = []```,output,1,300
empty a list `alist`,instruction,0,301
```alist[:] = []```,output,1,301
reset index of series `s`,instruction,0,302
```s.reset_index(0).reset_index(drop=True)```,output,1,302
convert unicode text from list `elems` with index 0 to normal text 'utf-8',instruction,0,303
```elems[0].getText().encode('utf-8')```,output,1,303
create a list containing the subtraction of each item in list `L` from the item prior to it,instruction,0,304
"```[(y - x) for x, y in zip(L, L[1:])]```",output,1,304
get value in string `line` matched by regex pattern '\\bLOG_ADDR\\s+(\\S+)',instruction,0,305
"```print(re.search('\\bLOG_ADDR\\s+(\\S+)', line).group(1))```",output,1,305
import all classes from module `some.package`,instruction,0,306
```globals().update(importlib.import_module('some.package').__dict__)```,output,1,306
"convert a list of characters `['a', 'b', 'c', 'd']` into a string",instruction,0,307
"```"""""""""""".join(['a', 'b', 'c', 'd'])```",output,1,307
"Slice `url` with '&' as delimiter  to get  ""http://www.domainname.com/page?CONTENT_ITEM_ID=1234"" from url ""http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
""",instruction,0,308
```url.split('&')```,output,1,308
sort dictionary `d` by key,instruction,0,309
```od = collections.OrderedDict(sorted(d.items()))```,output,1,309
sort a dictionary `d` by key,instruction,0,310
"```OrderedDict(sorted(list(d.items()), key=(lambda t: t[0])))```",output,1,310
Execute a put request to the url `url`,instruction,0,311
"```response = requests.put(url, data=json.dumps(data), headers=headers)```",output,1,311
replace everything that is not an alphabet or a digit with '' in 's'.,instruction,0,312
"```re.sub('[\\W_]+', '', s)```",output,1,312
create a list of aggregation of each element from list `l2` to all elements of list `l1`,instruction,0,313
```[(x + y) for x in l2 for y in l1]```,output,1,313
convert string `x'  to dictionary splitted by `=` using list comprehension,instruction,0,314
```dict([x.split('=') for x in s.split()])```,output,1,314
remove index 2 element from a list `my_list`,instruction,0,315
```my_list.pop(2)```,output,1,315
"Delete character ""M"" from a string `s` using python",instruction,0,316
"```s = s.replace('M', '')```",output,1,316
,instruction,0,317
"```newstr = oldstr.replace('M', '')```",output,1,317
get the sum of the products of each pair of corresponding elements in lists `a` and `b`,instruction,0,318
"```sum(x * y for x, y in zip(a, b))```",output,1,318
sum the products of each two elements at the same index of list `a` and list `b`,instruction,0,319
"```list(x * y for x, y in list(zip(a, b)))```",output,1,319
sum the product of each two items at the same index of list `a` and list `b`,instruction,0,320
"```sum(i * j for i, j in zip(a, b))```",output,1,320
sum the product of elements of two lists named `a` and `b`,instruction,0,321
"```sum(x * y for x, y in list(zip(a, b)))```",output,1,321
write the content of file `xxx.mp4` to file `f`,instruction,0,322
"```f.write(open('xxx.mp4', 'rb').read())```",output,1,322
Add 1 to each integer value in list `my_list`,instruction,0,323
```new_list = [(x + 1) for x in my_list]```,output,1,323
get a list of all items in list `j` with values greater than `5`,instruction,0,324
```[x for x in j if x >= 5]```,output,1,324
set color marker styles `--bo` in matplotlib,instruction,0,325
"```plt.plot(list(range(10)), '--bo')```",output,1,325
"set circle markers on plot for individual points  defined in list   `[1,2,3,4,5,6,7,8,9,10]` created by range(10)",instruction,0,326
"```plt.plot(list(range(10)), linestyle='--', marker='o', color='b')```",output,1,326
split strings in list `l` on the first occurring tab `\t` and enter only the first resulting substring in a new list,instruction,0,327
"```[i.split('\t', 1)[0] for i in l]```",output,1,327
Split each string in list `myList` on the tab character,instruction,0,328
```myList = [i.split('\t')[0] for i in myList]```,output,1,328
Sum numbers in a list 'your_list',instruction,0,329
```sum(your_list)```,output,1,329
attach debugger pdb to class `ForkedPdb`,instruction,0,330
```ForkedPdb().set_trace()```,output,1,330
Compose keys from dictionary `d1` with respective values in dictionary `d2`,instruction,0,331
"```result = {k: d2.get(v) for k, v in list(d1.items())}```",output,1,331
add one day and three hours to the present time from datetime.now(),instruction,0,332
"```datetime.datetime.now() + datetime.timedelta(days=1, hours=3)```",output,1,332
,instruction,0,333
"```[int(s[i:i + 3], 2) for i in range(0, len(s), 3)]```",output,1,333
switch keys and values in a dictionary `my_dict`,instruction,0,334
"```dict((v, k) for k, v in my_dict.items())```",output,1,334
sort a list `L` by number after second '.',instruction,0,335
"```print(sorted(L, key=lambda x: int(x.split('.')[2])))```",output,1,335
"Check if the value of the key ""name"" is ""Test"" in a list of dictionaries `label`",instruction,0,336
```any(d['name'] == 'Test' for d in label)```,output,1,336
"remove all instances of [1, 1] from list `a`",instruction,0,337
"```a[:] = [x for x in a if x != [1, 1]]```",output,1,337
"remove all instances of `[1, 1]` from a list `a`",instruction,0,338
"```[x for x in a if x != [1, 1]]```",output,1,338
"convert a list 'a' to a dictionary where each even element represents the key to the dictionary, and the following odd element is the value",instruction,0,339
"```b = {a[i]: a[i + 1] for i in range(0, len(a), 2)}```",output,1,339
check whether elements in list `a` appear only once,instruction,0,340
```len(set(a)) == len(a)```,output,1,340
Generate MD5 checksum of file in the path `full_path` in hashlib,instruction,0,341
"```print(hashlib.md5(open(full_path, 'rb').read()).hexdigest())```",output,1,341
,instruction,0,342
"```sorted(list(data.items()), key=lambda x: x[1][0])```",output,1,342
randomly switch letters' cases in string `s`,instruction,0,343
"```"""""""""""".join(x.upper() if random.randint(0, 1) else x for x in s)```",output,1,343
force bash interpreter '/bin/bash' to be used instead of shell,instruction,0,344
"```os.system('GREPDB=""echo 123""; /bin/bash -c ""$GREPDB""')```",output,1,344
Run a command `echo hello world` in bash instead of shell,instruction,0,345
"```os.system('/bin/bash -c ""echo hello world""')```",output,1,345
access the class variable `a_string` from a class object `test`,instruction,0,346
"```getattr(test, a_string)```",output,1,346
Display a image file `pathToFile`,instruction,0,347
```Image.open('pathToFile').show()```,output,1,347
"replace single quote character in string ""didn't"" with empty string ''",instruction,0,348
"```""""""didn't"""""".replace(""'"", '')```",output,1,348
sort list `files` based on variable `file_number`,instruction,0,349
```files.sort(key=file_number)```,output,1,349
remove all whitespace in a string `sentence`,instruction,0,350
"```sentence.replace(' ', '')```",output,1,350
remove all whitespace in a string `sentence`,instruction,0,351
"```pattern = re.compile('\\s+')
sentence = re.sub(pattern, '', sentence)```",output,1,351
remove whitespace in string `sentence` from beginning and end,instruction,0,352
```sentence.strip()```,output,1,352
remove all whitespaces in string `sentence`,instruction,0,353
"```sentence = re.sub('\\s+', '', sentence, flags=re.UNICODE)```",output,1,353
remove all whitespaces in a string `sentence`,instruction,0,354
```sentence = ''.join(sentence.split())```,output,1,354
sum all the values in a counter variable `my_counter`,instruction,0,355
```sum(my_counter.values())```,output,1,355
find the euclidean distance between two 3-d arrays `A` and `B`,instruction,0,356
```np.sqrt(((A - B) ** 2).sum(-1))```,output,1,356
create list `levels` containing 3 empty dictionaries,instruction,0,357
"```levels = [{}, {}, {}]```",output,1,357
find the sums of length 7 subsets of a list `daily`,instruction,0,358
"```weekly = [sum(visitors[x:x + 7]) for x in range(0, len(daily), 7)]```",output,1,358
Delete an element `key` from a dictionary `d`,instruction,0,359
```del d[key]```,output,1,359
Delete an element 0 from a dictionary `a`,instruction,0,360
```{i: a[i] for i in a if (i != 0)}```,output,1,360
"Delete an element ""hello"" from a dictionary `lol`",instruction,0,361
```lol.pop('hello')```,output,1,361
Delete an element with key `key` dictionary `r`,instruction,0,362
```del r[key]```,output,1,362
solve for the least squares' solution of matrices `a` and `b`,instruction,0,363
"```np.linalg.solve(np.dot(a.T, a), np.dot(a.T, b))```",output,1,363
split dictionary/list inside a pandas column 'b' into separate columns in dataframe `df`,instruction,0,364
"```pd.concat([df.drop('b', axis=1), pd.DataFrame(df['b'].tolist())], axis=1)```",output,1,364
loop through 0 to 10 with step 2,instruction,0,365
"```for i in range(0, 10, 2):
    pass```",output,1,365
loop through `mylist` with step 2,instruction,0,366
"```for i in mylist[::2]:
    pass```",output,1,366
lowercase string values with key 'content' in a list of dictionaries `messages`,instruction,0,367
```[{'content': x['content'].lower()} for x in messages]```,output,1,367
convert a list `my_list` into string with values separated by spaces,instruction,0,368
"```"""""" """""".join(my_list)```",output,1,368
replace each occurrence of the pattern '(http://\\S+|\\S*[^\\w\\s]\\S*)' within `a` with '',instruction,0,369
"```re.sub('(http://\\S+|\\S*[^\\w\\s]\\S*)', '', a)```",output,1,369
check if string `str` is palindrome,instruction,0,370
```str(n) == str(n)[::-1]```,output,1,370
upload binary file `myfile.txt` with ftplib,instruction,0,371
"```ftp.storbinary('STOR myfile.txt', open('myfile.txt', 'rb'))```",output,1,371
remove all characters from string `stri` upto character 'I',instruction,0,372
"```re.sub('.*I', 'I', stri)```",output,1,372
"parse a comma-separated string number '1,000,000' into int",instruction,0,373
"```int('1,000,000'.replace(',', ''))```",output,1,373
combine  dataframe `df1` and dataframe `df2` by index number,instruction,0,374
"```pd.merge(df1, df2, left_index=True, right_index=True, how='outer')```",output,1,374
,instruction,0,375
"```pandas.concat([df1, df2], axis=1)```",output,1,375
check if all boolean values in a python dictionary `dict` are true,instruction,0,376
```all(dict.values())```,output,1,376
use regex pattern '^12(?=.{4}$)' to remove digit 12 if followed by 4 other digits in column `c_contofficeID` of dataframe `df`,instruction,0,377
"```df.c_contofficeID.str.replace('^12(?=.{4}$)', '')```",output,1,377
reverse a list `L`,instruction,0,378
```L[::(-1)]```,output,1,378
reverse a list `array`,instruction,0,379
```reversed(array)```,output,1,379
reverse a list `L`,instruction,0,380
```L.reverse()```,output,1,380
reverse a list `array`,instruction,0,381
```list(reversed(array))```,output,1,381
get first element of each tuple in list `A`,instruction,0,382
```[tup[0] for tup in A]```,output,1,382
replace character 'a' with character 'e' and character 's' with character '3' in file `contents`,instruction,0,383
"```newcontents = contents.replace('a', 'e').replace('s', '3')```",output,1,383
serialise SqlAlchemy RowProxy object `row` to a json object,instruction,0,384
```json.dumps([dict(list(row.items())) for row in rs])```,output,1,384
get file '~/foo.ini',instruction,0,385
```config_file = os.path.expanduser('~/foo.ini')```,output,1,385
get multiple parameters with same name from a url in pylons,instruction,0,386
```request.params.getall('c')```,output,1,386
Convert array `x` into a correlation matrix,instruction,0,387
```np.corrcoef(x)```,output,1,387
"Find the greatest number in set `(1, 2, 3)`",instruction,0,388
"```print(max(1, 2, 3))```",output,1,388
Retrieve parameter 'var_name' from a GET request.,instruction,0,389
```self.request.get('var_name')```,output,1,389
"Add 100 to each element of column ""x"" in dataframe `a`",instruction,0,390
"```a['x'].apply(lambda x, y: x + y, args=(100,))```",output,1,390
Django get first 10 records of model `User` ordered by criteria 'age' of model 'pet',instruction,0,391
```User.objects.order_by('-pet__age')[:10]```,output,1,391
"delay for ""5"" seconds",instruction,0,392
```time.sleep(5)```,output,1,392
make a 60 seconds time delay,instruction,0,393
```time.sleep(60)```,output,1,393
make a 0.1 seconds time delay,instruction,0,394
```sleep(0.1)```,output,1,394
make a 60 seconds time delay,instruction,0,395
```time.sleep(60)```,output,1,395
make a 0.1 seconds time delay,instruction,0,396
```time.sleep(0.1)```,output,1,396
"From a list of strings `my_list`, remove the values that contains numbers.",instruction,0,397
```[x for x in my_list if not any(c.isdigit() for c in x)]```,output,1,397
get the middle two characters of a string 'state' in a pandas dataframe `df`,instruction,0,398
```df['state'].apply(lambda x: x[len(x) / 2 - 1:len(x) / 2 + 1])```,output,1,398
draw a grid line on every tick of plot `plt`,instruction,0,399
```plt.grid(True)```,output,1,399
sort list `lst` based on each element's number of occurrences,instruction,0,400
"```sorted(lst, key=lambda x: (-1 * c[x], lst.index(x)))```",output,1,400
Get the value with the maximum length in each column in array `foo`,instruction,0,401
```[max(len(str(x)) for x in line) for line in zip(*foo)]```,output,1,401
get the count of each unique value in column `Country` of dataframe `df` and store in column `Sum of Accidents`,instruction,0,402
```df.Country.value_counts().reset_index(name='Sum of Accidents')```,output,1,402
calculat the difference between each row and the row previous to it in dataframe `data`,instruction,0,403
```data.set_index('Date').diff()```,output,1,403
"append values `[3, 4]` to a set `a`",instruction,0,404
"```a.update([3, 4])```",output,1,404
set every two-stride far element to -1 starting from second element in array `a`,instruction,0,405
```a[1::2] = -1```,output,1,405
"Get rank of rows from highest to lowest of dataframe `df`, grouped by value in column `group`, according to value in column `value`",instruction,0,406
```df.groupby('group')['value'].rank(ascending=False)```,output,1,406
"convert js date object 'Tue, 22 Nov 2011 06:00:00 GMT' to python datetime",instruction,0,407
"```datetime.strptime('Tue, 22 Nov 2011 06:00:00 GMT', '%a, %d %b %Y %H:%M:%S %Z')```",output,1,407
Convert a binary value '1633837924' to string,instruction,0,408
"```struct.pack('<I', 1633837924)```",output,1,408
append string `foo` to list `list`,instruction,0,409
```list.append('foo')```,output,1,409
insert string `foo` at position `0` of list `list`,instruction,0,410
"```list.insert(0, 'foo')```",output,1,410
convert keys in dictionary `thedict` into case insensitive,instruction,0,411
```theset = set(k.lower() for k in thedict)```,output,1,411
pad 'dog' up to a length of 5 characters with 'x',instruction,0,412
"```""""""{s:{c}^{n}}"""""".format(s='dog', n=5, c='x')```",output,1,412
check if type of variable `s` is a string,instruction,0,413
"```isinstance(s, str)```",output,1,413
check if type of a variable `s` is string,instruction,0,414
"```isinstance(s, str)```",output,1,414
Convert list of dictionaries `L` into a flat dictionary,instruction,0,415
```dict(pair for d in L for pair in list(d.items()))```,output,1,415
merge a list of dictionaries in list `L` into a single dict,instruction,0,416
"```{k: v for d in L for k, v in list(d.items())}```",output,1,416
sort a pandas data frame according to column `Peak` in ascending and `Weeks` in descending order,instruction,0,417
"```df.sort_values(['Peak', 'Weeks'], ascending=[True, False], inplace=True)```",output,1,417
sort a pandas data frame by column `Peak` in ascending and `Weeks` in descending order,instruction,0,418
"```df.sort(['Peak', 'Weeks'], ascending=[True, False], inplace=True)```",output,1,418
"run the code contained in string ""print('Hello')""",instruction,0,419
"```eval(""print('Hello')"")```",output,1,419
"creating a list of dictionaries [{'A': 1, 'C': 4, 'B': 2, 'D': 4}, {'A': 1, 'C': 4, 'B': 1, 'D': 5}]",instruction,0,420
"```[{'A': 1, 'C': 4, 'B': 2, 'D': 4}, {'A': 1, 'C': 4, 'B': 1, 'D': 5}]```",output,1,420
,instruction,0,421
"```[{'A': 1, 'C': 4, 'B': 2, 'D': 4}, {'A': 1, 'C': 4, 'B': 1, 'D': 5}]```",output,1,421
get all possible combination of items from 2-dimensional list `a`,instruction,0,422
```list(itertools.product(*a))```,output,1,422
"Get sum of values of columns  'Y1961', 'Y1962', 'Y1963' after group by on columns ""Country"" and ""Item_code"" in dataframe `df`.",instruction,0,423
"```df.groupby(['Country', 'Item_Code'])[['Y1961', 'Y1962', 'Y1963']].sum()```",output,1,423
"create list `done` containing permutations of each element in list `[a, b, c, d]` with variable `x` as tuples",instruction,0,424
"```done = [(el, x) for el in [a, b, c, d]]```",output,1,424
remove Nan values from array `x`,instruction,0,425
```x = x[numpy.logical_not(numpy.isnan(x))]```,output,1,425
remove first directory from path '/First/Second/Third/Fourth/Fifth',instruction,0,426
```os.path.join(*x.split(os.path.sep)[2:])```,output,1,426
Replace `;` with `:` in a string `line`,instruction,0,427
"```line = line.replace(';', ':')```",output,1,427
call bash command 'tar c my_dir | md5sum' with pipe,instruction,0,428
"```subprocess.call('tar c my_dir | md5sum', shell=True)```",output,1,428
Convert a hex string `437c2123 ` according to ascii value.,instruction,0,429
"```""""""437c2123"""""".decode('hex')```",output,1,429
Get a list of all fields in class `User` that are marked `required`,instruction,0,430
"```[k for k, v in User._fields.items() if v.required]```",output,1,430
"remove column by index `[:, 0:2]` in dataframe `df`",instruction,0,431
"```df = df.ix[:, 0:2]```",output,1,431
change a string of integers `x` separated by spaces to a list of int,instruction,0,432
"```x = map(int, x.split())```",output,1,432
convert a string of integers `x` separated by spaces to a list of integers,instruction,0,433
```x = [int(i) for i in x.split()]```,output,1,433
"find element by css selector ""input[onclick*='1 Bedroom Deluxe']""",instruction,0,434
"```driver.find_element_by_css_selector(""input[onclick*='1 Bedroom Deluxe']"")```",output,1,434
,instruction,0,435
"```re.sub('[^a-zA-Z0-9-_*.]', '', my_string)```",output,1,435
display a pdf  file that has been downloaded as `my_pdf.pdf`,instruction,0,436
```webbrowser.open('file:///my_pdf.pdf')```,output,1,436
replace backslashes in string `result` with empty string '',instruction,0,437
"```result = result.replace('\\', '')```",output,1,437
remove backslashes from string `result`,instruction,0,438
"```result.replace('\\', '')```",output,1,438
"replace value '-' in any column of pandas dataframe to ""NaN""",instruction,0,439
"```df.replace('-', 'NaN')```",output,1,439
convert datetime object to date object in python,instruction,0,440
```datetime.datetime.now().date()```,output,1,440
,instruction,0,441
```datetime.datetime.now().date()```,output,1,441
get all sub-elements of an element `a` in an elementtree,instruction,0,442
```[elem.tag for elem in a.iter()]```,output,1,442
get all sub-elements of an element tree `a` excluding the root element,instruction,0,443
```[elem.tag for elem in a.iter() if elem is not a]```,output,1,443
,instruction,0,444
"```""""""2.7.0_bf4fda703454"""""".split('_')```",output,1,444
move dictionaries in list `lst` to the end of the list if value of key 'language' in each dictionary is not equal to 'en',instruction,0,445
"```sorted(lst, key=lambda x: x['language'] != 'en')```",output,1,445
check if all values of a dictionary `your_dict` are zero `0`,instruction,0,446
```all(value == 0 for value in list(your_dict.values()))```,output,1,446
produce a pivot table as dataframe using column 'Y' in datafram `df` to form the axes of the resulting dataframe,instruction,0,447
"```df.pivot_table('Y', rows='X', cols='X2')```",output,1,447
call `doSomething()` in a try-except without handling the exception,instruction,0,448
"```try:
    doSomething()
except:
    pass```",output,1,448
call `doSomething()` in a try-except without handling the exception,instruction,0,449
"```try:
    doSomething()
except Exception:
    pass```",output,1,449
get a sum of 4d array `M`,instruction,0,450
```M.sum(axis=0).sum(axis=0)```,output,1,450
Convert a datetime object `dt` to microtime,instruction,0,451
```time.mktime(dt.timetuple()) + dt.microsecond / 1000000.0```,output,1,451
select all rows in dataframe `df` where the values of column 'columnX' is bigger than or equal to `x` and smaller than or equal to `y`,instruction,0,452
```df[(x <= df['columnX']) & (df['columnX'] <= y)]```,output,1,452
sort a list of lists `L` by index 2 of the inner list,instruction,0,453
"```sorted(L, key=itemgetter(2))```",output,1,453
sort a list of lists `l` by index 2 of the inner list,instruction,0,454
```l.sort(key=(lambda x: x[2]))```,output,1,454
sort list `l` by index 2 of the item,instruction,0,455
"```sorted(l, key=(lambda x: x[2]))```",output,1,455
"sort a list of lists `list_to_sort` by indices 2,0,1 of the inner list",instruction,0,456
"```sorted_list = sorted(list_to_sort, key=itemgetter(2, 0, 1))```",output,1,456
"find rows of 2d array in 3d numpy array 'arr' if the row has value '[[0, 3], [3, 0]]'",instruction,0,457
"```np.argwhere(np.all(arr == [[0, 3], [3, 0]], axis=(1, 2)))```",output,1,457
From multiIndexed dataframe `data` select columns `a` and `c` within each higher order column `one` and `two`,instruction,0,458
"```data.loc[:, (list(itertools.product(['one', 'two'], ['a', 'c'])))]```",output,1,458
select only specific columns 'a' and 'c' from a dataframe 'data' with multiindex columns,instruction,0,459
"```data.loc[:, ([('one', 'a'), ('one', 'c'), ('two', 'a'), ('two', 'c')])]```",output,1,459
"match a sharp, followed by letters (including accent characters) in string `str1` using a regex",instruction,0,460
"```hashtags = re.findall('#(\\w+)', str1, re.UNICODE)```",output,1,460
Rename file from `src` to `dst`,instruction,0,461
"```os.rename(src, dst)```",output,1,461
Get all texts and tags from a tag `strong` from etree tag `some_tag` using lxml,instruction,0,462
```print(etree.tostring(some_tag.find('strong')))```,output,1,462
Serialize dictionary `data` and its keys to a JSON formatted string,instruction,0,463
"```json.dumps({str(k): v for k, v in data.items()})```",output,1,463
parse UTF-8 encoded HTML response `response` to BeautifulSoup object,instruction,0,464
```soup = BeautifulSoup(response.read().decode('utf-8'))```,output,1,464
delete file `filename`,instruction,0,465
```os.remove(filename)```,output,1,465
get the next value greatest to `2` from a list of numbers `num_list`,instruction,0,466
```min([x for x in num_list if x > 2])```,output,1,466
Replace each value in column 'prod_type' of dataframe `df` with string 'responsive',instruction,0,467
```df['prod_type'] = 'responsive'```,output,1,467
sort list `lst` with positives coming before negatives with values sorted respectively,instruction,0,468
"```sorted(lst, key=lambda x: (x < 0, x))```",output,1,468
get the date 6 months from today,instruction,0,469
```six_months = (date.today() + relativedelta(months=(+ 6)))```,output,1,469
get the date 1 month from today,instruction,0,470
"```(date(2010, 12, 31) + relativedelta(months=(+ 1)))```",output,1,470
get the date 2 months from today,instruction,0,471
"```(date(2010, 12, 31) + relativedelta(months=(+ 2)))```",output,1,471
calculate the date six months from the current date,instruction,0,472
```print((datetime.date.today() + datetime.timedelta(((6 * 365) / 12))).isoformat())```,output,1,472
get a list of keys of dictionary `things` sorted by the value of nested dictionary key 'weight',instruction,0,473
"```sorted(list(things.keys()), key=lambda x: things[x]['weight'], reverse=True)```",output,1,473
get all the values from a numpy array `a` excluding index 3,instruction,0,474
```a[np.arange(len(a)) != 3]```,output,1,474
delete all elements from a list `x` if a function `fn` taking value as parameter returns `0`,instruction,0,475
```[x for x in lst if fn(x) != 0]```,output,1,475
set dataframe `df` index using column 'month',instruction,0,476
```df.set_index('month')```,output,1,476
read lines from a csv file `./urls-eu.csv` into a list of lists `arr`,instruction,0,477
"```arr = [line.split(',') for line in open('./urls-eu.csv')]```",output,1,477
list comprehension that produces integers between 11 and 19,instruction,0,478
```[i for i in range(100) if i > 10 if i < 20]```,output,1,478
Get only digits from a string `strs`,instruction,0,479
"```"""""""""""".join([c for c in strs if c.isdigit()])```",output,1,479
split a string `yas` based on tab '\t',instruction,0,480
"```re.split('\\t+', yas.rstrip('\t'))```",output,1,480
scalar multiply matrix `a` by `b`,instruction,0,481
```(a.T * b).T```,output,1,481
"remove trailing newline in string ""test string\n""",instruction,0,482
```'test string\n'.rstrip()```,output,1,482
remove trailing newline in string 'test string \n\n',instruction,0,483
```'test string \n\n'.rstrip('\n')```,output,1,483
remove newline in string `s`,instruction,0,484
```s.strip()```,output,1,484
remove newline in string `s` on the right side,instruction,0,485
```s.rstrip()```,output,1,485
remove newline in string `s` on the left side,instruction,0,486
```s.lstrip()```,output,1,486
remove newline in string 'Mac EOL\r',instruction,0,487
```'Mac EOL\r'.rstrip('\r\n')```,output,1,487
remove newline in string 'Windows EOL\r\n' on the right side,instruction,0,488
```'Windows EOL\r\n'.rstrip('\r\n')```,output,1,488
remove newline in string 'Unix EOL\n' on the right side,instruction,0,489
```'Unix EOL\n'.rstrip('\r\n')```,output,1,489
"remove newline in string ""Hello\n\n\n"" on the right side",instruction,0,490
```'Hello\n\n\n'.rstrip('\n')```,output,1,490
split string `text` into chunks of 16 characters each,instruction,0,491
"```re.findall('.{,16}\\b', text)```",output,1,491
Get a list comprehension in list of lists `X`,instruction,0,492
```[[X[i][j] for j in range(len(X[i]))] for i in range(len(X))]```,output,1,492
convert unicode string '\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0' to byte string,instruction,0,493
```'\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0'.encode('latin-1')```,output,1,493
split dataframe `df` where the value of column `a` is equal to 'B',instruction,0,494
```df.groupby((df.a == 'B').shift(1).fillna(0).cumsum())```,output,1,494
save json output from a url ‘http://search.twitter.com/search.json?q=hi’ to file ‘hi.json’ in Python 2,instruction,0,495
"```urllib.request.urlretrieve('http://search.twitter.com/search.json?q=hi', 'hi.json')```",output,1,495
Find indices of elements equal to zero from numpy array `x`,instruction,0,496
```numpy.where((x == 0))[0]```,output,1,496
flush output of python print,instruction,0,497
```sys.stdout.flush()```,output,1,497
convert `i` to string,instruction,0,498
```str(i)```,output,1,498
convert `a` to string,instruction,0,499
```a.__str__()```,output,1,499
convert `a` to string,instruction,0,500
```str(a)```,output,1,500
sort list of lists `L` by the second item in each list,instruction,0,501
```L.sort(key=operator.itemgetter(1))```,output,1,501
Print variable `count` and variable `conv` with space string '    ' in between,instruction,0,502
```print(str(count) + '    ' + str(conv))```,output,1,502
change NaN values in dataframe `df` using preceding values in the frame,instruction,0,503
"```df.fillna(method='ffill', inplace=True)```",output,1,503
change the state of the Tkinter `Text` widget to read only i.e. `disabled`,instruction,0,504
```text.config(state=DISABLED)```,output,1,504
python sum of ascii values of all characters in a string `string`,instruction,0,505
"```sum(map(ord, string))```",output,1,505
apply itertools.product to elements of a list of lists `arrays`,instruction,0,506
```list(itertools.product(*arrays))```,output,1,506
print number `value` as thousands separators,instruction,0,507
"```'{:,}'.format(value)```",output,1,507
print number 1255000 as thousands separators,instruction,0,508
"```locale.setlocale(locale.LC_ALL, 'en_US')
locale.format('%d', 1255000, grouping=True)```",output,1,508
"get rows of dataframe `df` where column `Col1` has values `['men', 'rocks', 'mountains']`",instruction,0,509
"```df[df.Col1.isin(['men', 'rocks', 'mountains'])]```",output,1,509
get the value at index 1 for each tuple in the list of tuples `L`,instruction,0,510
```[x[1] for x in L]```,output,1,510
"split unicode string ""раз два три"" into words",instruction,0,511
```'\u0440\u0430\u0437 \u0434\u0432\u0430 \u0442\u0440\u0438'.split()```,output,1,511
sort query set by number of characters in a field `length` in django model `MyModel`,instruction,0,512
```MyModel.objects.extra(select={'length': 'Length(name)'}).order_by('length')```,output,1,512
get a dictionary in list `dicts` which key 'ratio' is closer to a global value 1.77672955975,instruction,0,513
"```min(dicts, key=lambda x: (abs(1.77672955975 - x['ratio']), -x['pixels']))```",output,1,513
get the non-masked values of array `m`,instruction,0,514
```m[~m.mask]```,output,1,514
Find all words containing letters between A and Z in string `formula`,instruction,0,515
"```re.findall('\\b[A-Z]', formula)```",output,1,515
"create a list `matrix` containing 5 lists, each of 5 items  all set to 0",instruction,0,516
```matrix = [([0] * 5) for i in range(5)]```,output,1,516
"creating a numpy array of 3d coordinates from three 1d arrays `x_p`, `y_p` and `z_p`",instruction,0,517
"```np.vstack(np.meshgrid(x_p, y_p, z_p)).reshape(3, -1).T```",output,1,517
find the minimum value in a numpy array `arr` excluding 0,instruction,0,518
```arr[arr != 0].min()```,output,1,518
"get the text of multiple elements found by xpath ""//*[@type='submit']/@value""",instruction,0,519
"```browser.find_elements_by_xpath(""//*[@type='submit']/@value"").text```",output,1,519
find all the values in attribute `value` for the tags whose `type` attribute is `submit` in selenium,instruction,0,520
"```browser.find_elements_by_xpath(""//*[@type='submit']"").get_attribute('value')```",output,1,520
"parse a YAML file ""example.yaml""",instruction,0,521
"```with open('example.yaml', 'r') as stream:
    try:
        print((yaml.load(stream)))
    except yaml.YAMLError as exc:
        print(exc)```",output,1,521
"parse a YAML file ""example.yaml""",instruction,0,522
"```with open('example.yaml') as stream:
    try:
        print((yaml.load(stream)))
    except yaml.YAMLError as exc:
        print(exc)```",output,1,522
Sort the values of the dataframe `df` and align the columns accordingly based on the obtained indices after np.argsort.,instruction,0,523
"```pd.DataFrame(df.columns[np.argsort(df.values)], df.index, np.unique(df.values))```",output,1,523
Getting today's date in YYYY-MM-DD,instruction,0,524
```datetime.datetime.today().strftime('%Y-%m-%d')```,output,1,524
urlencode a querystring 'string_of_characters_like_these:$#@=?%^Q^$' in python 2,instruction,0,525
```urllib.parse.quote_plus('string_of_characters_like_these:$#@=?%^Q^$')```,output,1,525
sort a dictionary `d` by length of its values and print as string,instruction,0,526
"```print(' '.join(sorted(d, key=lambda k: len(d[k]), reverse=True)))```",output,1,526
"convert tuple elements in list `[(1,2),(3,4),(5,6),]` into lists",instruction,0,527
"```map(list, zip(*[(1, 2), (3, 4), (5, 6)]))```",output,1,527
,instruction,0,528
"```map(list, zip(*[(1, 2), (3, 4), (5, 6)]))```",output,1,528
,instruction,0,529
"```zip(*[(1, 2), (3, 4), (5, 6)])```",output,1,529
"create a list of tuples which contains number 9 and the number before it, for each occurrence of 9 in the list 'myList'",instruction,0,530
"```[(x, y) for x, y in zip(myList, myList[1:]) if y == 9]```",output,1,530
navigate to webpage given by url `http://www.python.org` using Selenium,instruction,0,531
```driver.get('http://www.google.com.br')```,output,1,531
reverse a UTF-8 string 'a',instruction,0,532
```b = a.decode('utf8')[::-1].encode('utf8')```,output,1,532
extract date from a string 'monkey 2010-07-32 love banana',instruction,0,533
"```dparser.parse('monkey 2010-07-32 love banana', fuzzy=True)```",output,1,533
extract date from a string 'monkey 20/01/1980 love banana',instruction,0,534
"```dparser.parse('monkey 20/01/1980 love banana', fuzzy=True)```",output,1,534
extract date from a string `monkey 10/01/1980 love banana`,instruction,0,535
"```dparser.parse('monkey 10/01/1980 love banana', fuzzy=True)```",output,1,535
"Convert a list `['A:1', 'B:2', 'C:3', 'D:4']` to dictionary",instruction,0,536
"```dict(map(lambda s: s.split(':'), ['A:1', 'B:2', 'C:3', 'D:4']))```",output,1,536
check if string `the_string` contains any upper or lower-case ASCII letters,instruction,0,537
"```re.search('[a-zA-Z]', the_string)```",output,1,537
convert a pandas `df1` groupby object to dataframe,instruction,0,538
"```DataFrame({'count': df1.groupby(['Name', 'City']).size()}).reset_index()```",output,1,538
remove all non-numeric characters from string `sdkjh987978asd098as0980a98sd `,instruction,0,539
"```re.sub('[^0-9]', '', 'sdkjh987978asd098as0980a98sd')```",output,1,539
get items from list `a` that don't appear in list `b`,instruction,0,540
```[y for y in a if y not in b]```,output,1,540
extract the first four rows of the column `ID` from a pandas dataframe `df`,instruction,0,541
```df.groupby('ID').head(4)```,output,1,541
Unzip a list of tuples `l` into a list of lists,instruction,0,542
```zip(*l)```,output,1,542
"combine two lists `[1, 2, 3, 4]` and `['a', 'b', 'c', 'd']` into a dictionary",instruction,0,543
"```dict(zip([1, 2, 3, 4], ['a', 'b', 'c', 'd']))```",output,1,543
"combine two lists `[1, 2, 3, 4]` and `['a', 'b', 'c', 'd']` into a dictionary",instruction,0,544
"```dict(zip([1, 2, 3, 4], ['a', 'b', 'c', 'd']))```",output,1,544
retrieve the path from a Flask request,instruction,0,545
```request.url```,output,1,545
replace carriage return in string `somestring` with empty string '',instruction,0,546
"```somestring.replace('\\r', '')```",output,1,546
"serialize dictionary `d` as a JSON formatted string with each key formatted to pattern '%d,%d'",instruction,0,547
"```simplejson.dumps(dict([('%d,%d' % k, v) for k, v in list(d.items())]))```",output,1,547
"parse string ""Jun 1 2005  1:33PM"" into datetime by format ""%b %d %Y %I:%M%p""",instruction,0,548
"```datetime.strptime('Jun 1 2005  1:33PM', '%b %d %Y %I:%M%p')```",output,1,548
"parse string ""Aug 28 1999 12:00AM"" into datetime",instruction,0,549
```parser.parse('Aug 28 1999 12:00AM')```,output,1,549
Get absolute folder path and filename for file `existGDBPath `,instruction,0,550
```os.path.split(os.path.abspath(existGDBPath))```,output,1,550
extract folder path from file path,instruction,0,551
```os.path.dirname(os.path.abspath(existGDBPath))```,output,1,551
Execute a post request to url `http://httpbin.org/post` with json data `{'test': 'cheers'}`,instruction,0,552
"```requests.post('http://httpbin.org/post', json={'test': 'cheers'})```",output,1,552
remove dictionary from list `a` if the value associated with its key 'link' is in list `b`,instruction,0,553
```a = [x for x in a if x['link'] not in b]```,output,1,553
get a request parameter `a` in jinja2,instruction,0,554
```{{request.args.get('a')}}```,output,1,554
create a list of integers between 2 values `11` and `17`,instruction,0,555
"```list(range(11, 17))```",output,1,555
Change data type of data in column 'grade' of dataframe `data_df` into float and then to int,instruction,0,556
```data_df['grade'] = data_df['grade'].astype(float).astype(int)```,output,1,556
Find the list in a list of lists `alkaline_earth_values` with the max value of the second element.,instruction,0,557
"```max(alkaline_earth_values, key=lambda x: x[1])```",output,1,557
remove leading and trailing zeros in the string 'your_Strip',instruction,0,558
```your_string.strip('0')```,output,1,558
generate a list of all unique pairs of integers in `range(9)`,instruction,0,559
"```list(permutations(list(range(9)), 2))```",output,1,559
create a regular expression that matches the pattern '^(.+)(?:\\n|\\r\\n?)((?:(?:\\n|\\r\\n?).+)+)' over multiple lines of text,instruction,0,560
"```re.compile('^(.+)(?:\\n|\\r\\n?)((?:(?:\\n|\\r\\n?).+)+)', re.MULTILINE)```",output,1,560
"regular expression ""^(.+)\\n((?:\\n.+)+)"" matching a multiline block of text",instruction,0,561
"```re.compile('^(.+)\\n((?:\\n.+)+)', re.MULTILINE)```",output,1,561
Run 'test2.py' file with python location 'path/to/python' and arguments 'neededArgumetGoHere' as a subprocess,instruction,0,562
"```call(['path/to/python', 'test2.py', 'neededArgumetGoHere'])```",output,1,562
sort a multidimensional list `a` by second and third column,instruction,0,563
"```a.sort(key=operator.itemgetter(2, 3))```",output,1,563
Add a tuple with value `another_choice` to a tuple `my_choices`,instruction,0,564
"```final_choices = ((another_choice,) + my_choices)```",output,1,564
Add a tuple with value `another_choice` to a tuple `my_choices`,instruction,0,565
"```final_choices = ((another_choice,) + my_choices)```",output,1,565
find the current directory,instruction,0,566
```os.getcwd()```,output,1,566
find the current directory,instruction,0,567
```os.path.realpath(__file__)```,output,1,567
get the directory name of `path`,instruction,0,568
```os.path.dirname(path)```,output,1,568
get the canonical path of file `path`,instruction,0,569
```os.path.realpath(path)```,output,1,569
Find name of current directory,instruction,0,570
```dir_path = os.path.dirname(os.path.realpath(__file__))```,output,1,570
Find current directory,instruction,0,571
```cwd = os.getcwd()```,output,1,571
Find the full path of current directory,instruction,0,572
```full_path = os.path.realpath(__file__)```,output,1,572
sort array `arr` in ascending order by values of the 3rd column,instruction,0,573
"```arr[arr[:, (2)].argsort()]```",output,1,573
sort rows of numpy matrix `arr` in ascending order according to all column values,instruction,0,574
"```numpy.sort(arr, axis=0)```",output,1,574
"split string 'a b.c' on space "" "" and dot character "".""",instruction,0,575
"```re.split('[ .]', 'a b.c')```",output,1,575
copy the content of file 'file.txt' to file 'file2.txt',instruction,0,576
"```shutil.copy('file.txt', 'file2.txt')```",output,1,576
generate random upper-case ascii string of 12 characters length,instruction,0,577
```print(''.join(choice(ascii_uppercase) for i in range(12)))```,output,1,577
merge the elements in a list `lst` sequentially,instruction,0,578
"```[''.join(seq) for seq in zip(lst, lst[1:])]```",output,1,578
rename column 'gdp' in dataframe `data` to 'log(gdp)',instruction,0,579
"```data.rename(columns={'gdp': 'log(gdp)'}, inplace=True)```",output,1,579
convert a beautiful soup html `soup` to text,instruction,0,580
```print(soup.get_text())```,output,1,580
Sort list `li` in descending order based on the second element of each list inside list`li`,instruction,0,581
"```sorted(li, key=operator.itemgetter(1), reverse=True)```",output,1,581
replace value 0 with 'Female' and value 1 with 'Male' in column 'sex' of dataframe `data`,instruction,0,582
"```data['sex'].replace([0, 1], ['Female', 'Male'], inplace=True)```",output,1,582
"split string 'Words, words, words.' on punctuation",instruction,0,583
"```re.split('\\W+', 'Words, words, words.')```",output,1,583
"Extract first two substrings in string `phrase` that end in `.`, `?` or `!`",instruction,0,584
"```re.match('(.*?[.?!](?:\\s+.*?[.?!]){0,1})', phrase).group(1)```",output,1,584
split string `s` into strings of repeating elements,instruction,0,585
"```print([a for a, b in re.findall('((\\w)\\2*)', s)])```",output,1,585
Create new string with unique characters from `s` seperated by ' ',instruction,0,586
```print(' '.join(OrderedDict.fromkeys(s)))```,output,1,586
create a set from string `s` to remove duplicate characters,instruction,0,587
```print(' '.join(set(s)))```,output,1,587
list folders in zip file 'file' that ends with '/',instruction,0,588
```[x for x in file.namelist() if x.endswith('/')]```,output,1,588
find the count of a word 'Hello' in a string `input_string`,instruction,0,589
```input_string.count('Hello')```,output,1,589
"reduce the first element of list of strings `data` to a string, separated by '.'",instruction,0,590
```print('.'.join([item[0] for item in data]))```,output,1,590
Move the cursor of file pointer `fh1` at the end of the file.,instruction,0,591
```fh1.seek(2)```,output,1,591
"convert a flat list into a list of tuples of every two items in the list, in order",instruction,0,592
"```print(zip(my_list[0::2], my_list[1::2]))```",output,1,592
group a list of ints into a list of tuples of each 2 elements,instruction,0,593
"```my_new_list = zip(my_list[0::2], my_list[1::2])```",output,1,593
set the default encoding to 'utf-8',instruction,0,594
```sys.setdefaultencoding('utf8')```,output,1,594
Formate current date and time to a string using pattern '%Y-%m-%d %H:%M:%S',instruction,0,595
```datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')```,output,1,595
retrieve arabic texts from string `my_string`,instruction,0,596
"```print(re.findall('[\\u0600-\\u06FF]+', my_string))```",output,1,596
group dataframe `df` based on minute interval,instruction,0,597
```df.groupby(df.index.map(lambda t: t.minute))```,output,1,597
access value associated with key 'American' of key 'Apple' from dictionary `dict`,instruction,0,598
```dict['Apple']['American']```,output,1,598
"remove all null values from columns 'three', 'four' and 'five' of dataframe `df2`",instruction,0,599
"```df2.dropna(subset=['three', 'four', 'five'], how='all')```",output,1,599
insert a list `k` at the front of list `a`,instruction,0,600
"```a.insert(0, k)```",output,1,600
insert elements of list `k` into list `a` at position `n`,instruction,0,601
```a = a[:n] + k + a[n:]```,output,1,601
calculate the mean of the nonzero values' indices of dataframe `df`,instruction,0,602
```np.flatnonzero(x).mean()```,output,1,602
get date from dataframe `df` column 'dates' to column 'just_date',instruction,0,603
```df['just_date'] = df['dates'].dt.date```,output,1,603
remove elements in list `b` from list `a`,instruction,0,604
```[x for x in a if x not in b]```,output,1,604
join elements of each tuple in list `a` into one string,instruction,0,605
```[''.join(x) for x in a]```,output,1,605
join items of each tuple in list of tuples `a` into a list of strings,instruction,0,606
"```list(map(''.join, a))```",output,1,606
match blank lines in `s` with regular expressions,instruction,0,607
"```re.split('\n\\s*\n', s)```",output,1,607
"merge a list of integers `[1, 2, 3, 4, 5]` into a single integer",instruction,0,608
"```from functools import reduce
reduce(lambda x, y: 10 * x + y, [1, 2, 3, 4, 5])```",output,1,608
Convert float 24322.34 to comma-separated string,instruction,0,609
"```""""""{0:,.2f}"""""".format(24322.34)```",output,1,609
pass dictionary items `data` as keyword arguments in function `my_function`,instruction,0,610
```my_function(**data)```,output,1,610
get line count of file 'myfile.txt',instruction,0,611
```sum((1 for line in open('myfile.txt')))```,output,1,611
get line count of file `filename`,instruction,0,612
"```def bufcount(filename):
    f = open(filename)
    lines = 0
    buf_size = (1024 * 1024)
    read_f = f.read
    buf = read_f(buf_size)
    while buf:
        lines += buf.count('\n')
        buf = read_f(buf_size)
    return lines```",output,1,612
round 1123.456789 to be an integer,instruction,0,613
"```print(round(1123.456789, -1))```",output,1,613
sort list `X` based on values from another list `Y`,instruction,0,614
"```[x for y, x in sorted(zip(Y, X))]```",output,1,614
sorting list 'X' based on values from another list 'Y',instruction,0,615
"```[x for y, x in sorted(zip(Y, X))]```",output,1,615
get equivalent week number from a date `2010/6/16` using  isocalendar,instruction,0,616
"```datetime.date(2010, 6, 16).isocalendar()[1]```",output,1,616
"select multiple ranges of columns 1-10, 15, 17, and 50-100 in pandas dataframe `df`",instruction,0,617
"```df.iloc[:, (np.r_[1:10, (15), (17), 50:100])]```",output,1,617
apply two different aggregating functions `mean` and `sum` to the same column `dummy` in pandas data frame `df`,instruction,0,618
"```df.groupby('dummy').agg({'returns': [np.mean, np.sum]})```",output,1,618
convert string `s` to lowercase,instruction,0,619
```s.lower()```,output,1,619
convert utf-8 string `s` to lowercase,instruction,0,620
```s.decode('utf-8').lower()```,output,1,620
,instruction,0,621
"```ftp.retrbinary('RETR %s' % filename, file.write)```",output,1,621
handle the `urlfetch_errors ` exception for imaplib request to url `url`,instruction,0,622
"```urlfetch.fetch(url, deadline=10 * 60)```",output,1,622
output first 100 characters in a string `my_string`,instruction,0,623
```print(my_string[0:100])```,output,1,623
make matplotlib plot legend put marker in legend only once,instruction,0,624
```legend(numpoints=1)```,output,1,624
get set intersection between dictionaries `d1` and `d2`,instruction,0,625
"```dict((x, set(y) & set(d1.get(x, ()))) for x, y in d2.items())```",output,1,625
convert csv file 'test.csv' into two-dimensional matrix,instruction,0,626
"```numpy.loadtxt(open('test.csv', 'rb'), delimiter=',', skiprows=1)```",output,1,626
filter the objects in django model 'Sample' between date range `2011-01-01` and `2011-01-31`,instruction,0,627
"```Sample.objects.filter(date__range=['2011-01-01', '2011-01-31'])```",output,1,627
filter objects month wise in django model `Sample` for year `2011`,instruction,0,628
"```Sample.objects.filter(date__year='2011', date__month='01')```",output,1,628
"create a dictionary `{'spam': 5, 'ham': 6}` into another dictionary `d` field 'dict3'",instruction,0,629
"```d['dict3'] = {'spam': 5, 'ham': 6}```",output,1,629
apply `numpy.linalg.norm` to each row of a matrix `a`,instruction,0,630
"```numpy.apply_along_axis(numpy.linalg.norm, 1, a)```",output,1,630
merge dictionaries form array `dicts` in a single expression,instruction,0,631
"```dict((k, v) for d in dicts for k, v in list(d.items()))```",output,1,631
Convert escaped utf string to utf string in `your string`,instruction,0,632
```print('your string'.decode('string_escape'))```,output,1,632
"counting the number of true booleans in a python list `[True, True, False, False, False, True]`",instruction,0,633
"```sum([True, True, False, False, False, True])```",output,1,633
"set the size of figure `fig` in inches to width height of `w`, `h`",instruction,0,634
"```fig.set_size_inches(w, h, forward=True)```",output,1,634
format string with dict `{'5': 'you'}` with integer keys,instruction,0,635
```'hello there %(5)s' % {'5': 'you'}```,output,1,635
"Convert a string of numbers `example_string` separated by `,` into a list of integers",instruction,0,636
"```map(int, example_string.split(','))```",output,1,636
Convert a string of numbers 'example_string' separated by comma into a list of numbers,instruction,0,637
"```[int(s) for s in example_string.split(',')]```",output,1,637
Flatten list `x`,instruction,0,638
```x = [i[0] for i in x]```,output,1,638
convert list `x` into a flat list,instruction,0,639
"```y = map(operator.itemgetter(0), x)```",output,1,639
get a list `y` of the first element of every tuple in list `x`,instruction,0,640
```y = [i[0] for i in x]```,output,1,640
extract all the values of a specific key named 'values' from a list of dictionaries,instruction,0,641
```results = [item['value'] for item in test_data]```,output,1,641
get current datetime in ISO format,instruction,0,642
```datetime.datetime.now().isoformat()```,output,1,642
get UTC datetime in ISO format,instruction,0,643
```datetime.datetime.utcnow().isoformat()```,output,1,643
Merge all columns in dataframe `df` into one column,instruction,0,644
"```df.apply(' '.join, axis=0)```",output,1,644
pandas subtract a row from dataframe `df2` from dataframe `df`,instruction,0,645
"```pd.DataFrame(df.values - df2.values, columns=df.columns)```",output,1,645
read file 'myfile.txt' using universal newline mode 'U',instruction,0,646
"```print(open('myfile.txt', 'U').read())```",output,1,646
print line `line` from text file with 'utf-16-le' format,instruction,0,647
```print(line.decode('utf-16-le').split())```,output,1,647
open a text file `data.txt` in io module with encoding `utf-16-le`,instruction,0,648
"```file = io.open('data.txt', 'r', encoding='utf-16-le')```",output,1,648
Join data of dataframe `df1` with data in dataframe `df2` based on similar values of column 'user_id' in both dataframes,instruction,0,649
"```s1 = pd.merge(df1, df2, how='inner', on=['user_id'])```",output,1,649
check if string `foo` is UTF-8 encoded,instruction,0,650
```foo.decode('utf8').encode('utf8')```,output,1,650
get the dimensions of numpy array `a`,instruction,0,651
```a.shape```,output,1,651
get the dimensions of numpy array `a`,instruction,0,652
```N.shape(a)```,output,1,652
get the dimensions of array `a`,instruction,0,653
```N.shape(a)```,output,1,653
get the dimensions of numpy array `a`,instruction,0,654
```a.shape```,output,1,654
get the indices of tuples in list of tuples `L` where the first value is 53,instruction,0,655
"```[i for i, v in enumerate(L) if v[0] == 53]```",output,1,655
convert string of bytes `y\xcc\xa6\xbb` into an int,instruction,0,656
"```struct.unpack('<L', 'y\xcc\xa6\xbb')[0]```",output,1,656
"get the first row, second column; second row, first column, and first row third column values of numpy array `arr`",instruction,0,657
"```arr[[0, 1, 1], [1, 0, 2]]```",output,1,657
create a list with permutations of string 'abcd',instruction,0,658
```list(powerset('abcd'))```,output,1,658
Convert string to boolean from defined set of strings,instruction,0,659
"```s in ['true', '1', 't', 'y', 'yes', 'yeah', 'yup', 'certainly', 'uh-huh']```",output,1,659
replace special characters in url 'http://spam.com/go/' using the '%xx' escape,instruction,0,660
```urllib.parse.quote('http://spam.com/go/')```,output,1,660
Save plot `plt` as svg file 'test.svg',instruction,0,661
```plt.savefig('test.svg')```,output,1,661
count the number of elements in array `myArray`,instruction,0,662
```len(myArray)```,output,1,662
insert directory './path/to/your/modules/' to current directory,instruction,0,663
"```sys.path.insert(0, './path/to/your/modules/')```",output,1,663
,instruction,0,664
```ax.xaxis.set_ticks_position('top')```,output,1,664
"Insert records in bulk from ""table1"" of ""master"" DB to ""table1"" of  sqlite3 `cursor` object",instruction,0,665
```cursor.execute('INSERT OR REPLACE INTO master.table1 SELECT * FROM table1')```,output,1,665
Match regex '[a-zA-Z][\\w-]*\\Z' on string 'A\n',instruction,0,666
"```re.match('[a-zA-Z][\\w-]*\\Z', 'A\n')```",output,1,666
match regex '[a-zA-Z][\\w-]*$' on string '!A_B',instruction,0,667
"```re.match('[a-zA-Z][\\w-]*$', '!A_B')```",output,1,667
"Convert hex string ""deadbeef"" to integer",instruction,0,668
"```int('deadbeef', 16)```",output,1,668
"Convert hex string ""a"" to integer",instruction,0,669
"```int('a', 16)```",output,1,669
"Convert hex string ""0xa"" to integer",instruction,0,670
"```int('0xa', 16)```",output,1,670
Convert hex string `s` to integer,instruction,0,671
"```int(s, 16)```",output,1,671
Convert hex string `hexString` to int,instruction,0,672
"```int(hexString, 16)```",output,1,672
print variable `value ` without spaces,instruction,0,673
"```print('Value is ""' + str(value) + '""')```",output,1,673
Print a string `value` with string formatting,instruction,0,674
"```print('Value is ""{}""'.format(value))```",output,1,674
Jinja join elements of array `tags` with space string ' ',instruction,0,675
```{{tags | join(' ')}}```,output,1,675
get a list of locally installed Python modules,instruction,0,676
```help('modules')```,output,1,676
Get only first element in each of the innermost of the multidimensional list `listD`,instruction,0,677
```[[[x[0]] for x in listD[i]] for i in range(len(listD))]```,output,1,677
Sort a string `s` in lexicographic order,instruction,0,678
"```sorted(s, key=str.upper)```",output,1,678
sort string `s` in lexicographic order,instruction,0,679
"```sorted(sorted(s), key=str.upper)```",output,1,679
"get a sorted list of the characters of string `s` in lexicographic order, with lowercase letters first",instruction,0,680
"```sorted(s, key=str.lower)```",output,1,680
"find all the rows in Dataframe 'df2' that are also present in Dataframe 'df1', for the columns 'A', 'B', 'C' and 'D'.",instruction,0,681
"```pd.merge(df1, df2, on=['A', 'B', 'C', 'D'], how='inner')```",output,1,681
Reverse key-value pairs in a dictionary `map`,instruction,0,682
"```dict((v, k) for k, v in map.items())```",output,1,682
decode unicode string `s` into a readable unicode literal,instruction,0,683
```s.decode('unicode_escape')```,output,1,683
convert list of strings `str_list` into list of integers,instruction,0,684
```[int(i) for i in str_list]```,output,1,684
"convert a list with string `['1', '2', '3']` into list with integers",instruction,0,685
"```map(int, ['1', '2', '3'])```",output,1,685
convert list with str into list with int,instruction,0,686
"```list(map(int, ['1', '2', '3']))```",output,1,686
find all anchor tags in html `soup` whose url begins with `http://www.iwashere.com`,instruction,0,687
"```soup.find_all('a', href=re.compile('http://www\\.iwashere\\.com/'))```",output,1,687
find all anchors with a hyperlink that matches the pattern '^(?!(?:[a-zA-Z][a-zA-Z0-9+.-]*:|//))',instruction,0,688
"```soup.find_all('a', href=re.compile('^(?!(?:[a-zA-Z][a-zA-Z0-9+.-]*:|//))'))```",output,1,688
execute a jar file 'Blender.jar' using subprocess,instruction,0,689
"```subprocess.call(['java', '-jar', 'Blender.jar'])```",output,1,689
insert row into mysql database with column 'column1' set to the value `value`,instruction,0,690
"```cursor.execute('INSERT INTO table (`column1`) VALUES (%s)', (value,))```",output,1,690
"remove a substring "".com"" from the end of string `url`",instruction,0,691
"```if url.endswith('.com'):
    url = url[:(-4)]```",output,1,691
"remove a substring "".com"" from the end of string `url`",instruction,0,692
"```url = re.sub('\\.com$', '', url)```",output,1,692
"remove a substring "".com"" from the end of string `url`",instruction,0,693
"```print(url.replace('.com', ''))```",output,1,693
remove a substring `suffix` from the end of string `text`,instruction,0,694
"```if (not text.endswith(suffix)):
    return text
return text[:(len(text) - len(suffix))]```",output,1,694
print each first value from a list of tuples `mytuple` with string formatting,instruction,0,695
"```print(', ,'.join([str(i[0]) for i in mytuple]))```",output,1,695
clamping floating number `my_value` to be between `min_value` and `max_value`,instruction,0,696
"```max(min(my_value, max_value), min_value)```",output,1,696
split a unicode string `text` into a list of words and punctuation characters with a regex,instruction,0,697
"```re.findall('\\w+|[^\\w\\s]', text, re.UNICODE)```",output,1,697
execute raw sql queue '<sql here>' in database `db` in sqlalchemy-flask app,instruction,0,698
```result = db.engine.execute('<sql here>')```,output,1,698
quit program,instruction,0,699
```sys.exit(0)```,output,1,699
get digits in string `my_string`,instruction,0,700
"```"""""""""""".join(c for c in my_string if c.isdigit())```",output,1,700
split string `str1` on one or more spaces with a regular expression,instruction,0,701
"```re.split(' +', str1)```",output,1,701
,instruction,0,702
"```re.findall('\\S+', str1)```",output,1,702
Evaluate a nested dictionary `myobject.id.number` to get `number` if `myobject` is present with getattr,instruction,0,703
"```getattr(getattr(myobject, 'id', None), 'number', None)```",output,1,703
convert generator object to a dictionary,instruction,0,704
```{i: (i * 2) for i in range(10)}```,output,1,704
convert generator object to a dictionary,instruction,0,705
"```dict((i, i * 2) for i in range(10))```",output,1,705
Matplotlib clear the current axes.,instruction,0,706
```plt.cla()```,output,1,706
split string `s` into float values and write sum to `total`,instruction,0,707
"```total = sum(float(item) for item in s.split(','))```",output,1,707
Convert ascii value 'P' to binary,instruction,0,708
```bin(ord('P'))```,output,1,708
"print a string after a specific substring ', ' in string `my_string `",instruction,0,709
"```print(my_string.split(', ', 1)[1])```",output,1,709
get value of key `post code` associated with first index of key `places` of dictionary `data`,instruction,0,710
```print(data['places'][0]['post code'])```,output,1,710
remove colon character surrounded by vowels letters in string `word`,instruction,0,711
"```word = re.sub('([aeiou]):(([aeiou][^aeiou]*){3})$', '\\1\\2', word)```",output,1,711
extract data field 'bar' from json object,instruction,0,712
"```json.loads('{""foo"": 42, ""bar"": ""baz""}')['bar']```",output,1,712
Convert JSON array `array` to Python object,instruction,0,713
```data = json.loads(array)```,output,1,713
Convert JSON array `array` to Python object,instruction,0,714
```data = json.loads(array)```,output,1,714
pars a string 'http://example.org/#comments' to extract hashtags into an array,instruction,0,715
"```re.findall('#(\\w+)', 'http://example.org/#comments')```",output,1,715
do a boolean check if a string `lestring` contains any of the items in list `lelist`,instruction,0,716
```any(e in lestring for e in lelist)```,output,1,716
,instruction,0,717
"```df.plot(x='col_name_1', y='col_name_2', style='o')```",output,1,717
Parsing HTML string `html` using BeautifulSoup,instruction,0,718
"```parsed_html = BeautifulSoup(html)
print(parsed_html.body.find('div', attrs={'class': 'container', }).text)```",output,1,718
Parsing webpage 'http://www.google.com/' using BeautifulSoup,instruction,0,719
"```page = urllib.request.urlopen('http://www.google.com/')
soup = BeautifulSoup(page)```",output,1,719
change figure size to 3 by 4 in matplotlib,instruction,0,720
"```plt.figure(figsize=(3, 4))```",output,1,720
Strip punctuation from string `s`,instruction,0,721
"```s.translate(None, string.punctuation)```",output,1,721
django urlsafe base64 decode string `uenc` with decryption,instruction,0,722
```base64.urlsafe_b64decode(uenc.encode('ascii'))```,output,1,722
get the number of all keys in the nested dictionary `dict_list`,instruction,0,723
```len(dict_test) + sum(len(v) for v in dict_test.values())```,output,1,723
return the conversion of decimal `d` to hex without the '0x' prefix,instruction,0,724
```hex(d).split('x')[1]```,output,1,724
create a list containing digits of number 123 as its elements,instruction,0,725
```list(str(123))```,output,1,725
converting integer `num` to list,instruction,0,726
```[int(x) for x in str(num)]```,output,1,726
select a first form with no name in mechanize,instruction,0,727
```br.select_form(nr=0)```,output,1,727
Open file 'sample.json' in read mode with encoding of 'utf-8-sig',instruction,0,728
"```json.load(codecs.open('sample.json', 'r', 'utf-8-sig'))```",output,1,728
load json file 'sample.json' with utf-8 bom header,instruction,0,729
```json.loads(open('sample.json').read().decode('utf-8-sig'))```,output,1,729
setup a smtp mail server to `smtp.gmail.com` with port `587`,instruction,0,730
"```server = smtplib.SMTP('smtp.gmail.com', 587)```",output,1,730
revers correlating bits of integer `n`,instruction,0,731
"```int('{:08b}'.format(n)[::-1], 2)```",output,1,731
add column `d` to index of dataframe `df`,instruction,0,732
"```df.set_index(['d'], append=True)```",output,1,732
Iterating over a dictionary `d` using for loops,instruction,0,733
"```for (key, value) in d.items():
    pass```",output,1,733
Iterating over a dictionary `d` using for loops,instruction,0,734
"```for (key, value) in list(d.items()):
    pass```",output,1,734
Iterating key and items over dictionary `d`,instruction,0,735
"```for (letter, number) in list(d.items()):
    pass```",output,1,735
Iterating key and items over dictionary `d`,instruction,0,736
"```for (k, v) in list(d.items()):
    pass```",output,1,736
get keys and items of dictionary `d`,instruction,0,737
```list(d.items())```,output,1,737
get keys and items of dictionary `d` as a list,instruction,0,738
```list(d.items())```,output,1,738
Iterating key and items over dictionary `d`,instruction,0,739
"```for (k, v) in list(d.items()):
    pass```",output,1,739
Iterating key and items over dictionary `d`,instruction,0,740
"```for (letter, number) in list(d.items()):
    pass```",output,1,740
Iterating key and items over dictionary `d`,instruction,0,741
"```for (letter, number) in list(d.items()):
    pass```",output,1,741
query all data from table `Task` where the value of column `time_spent` is bigger than 3 hours,instruction,0,742
```session.query(Task).filter(Task.time_spent > timedelta(hours=3)).all()```,output,1,742
compile Visual Studio project `project.sln` from the command line through python,instruction,0,743
```os.system('msbuild project.sln /p:Configuration=Debug')```,output,1,743
get max key in dictionary `MyCount`,instruction,0,744
"```max(list(MyCount.keys()), key=int)```",output,1,744
execute command 'source .bashrc; shopt -s expand_aliases; nuke -x scriptPath' from python script,instruction,0,745
```os.system('source .bashrc; shopt -s expand_aliases; nuke -x scriptPath')```,output,1,745
get a name of function `my_function` as a string,instruction,0,746
```my_function.__name__```,output,1,746
,instruction,0,747
```my_function.__name__```,output,1,747
check if all values in the columns of a numpy matrix `a` are same,instruction,0,748
"```np.all(a == a[(0), :], axis=0)```",output,1,748
sort list `a` in ascending order based on the addition of the second and third elements of each tuple in it,instruction,0,749
"```sorted(a, key=lambda x: (sum(x[1:3]), x[0]))```",output,1,749
sort a list of tuples `a` by the sum of second and third element of each tuple,instruction,0,750
"```sorted(a, key=lambda x: (sum(x[1:3]), x[0]), reverse=True)```",output,1,750
"sorting a list of tuples `lst` by the sum of the second elements onwards, and third element of the tuple",instruction,0,751
"```sorted(lst, key=lambda x: (sum(x[1:]), x[0]))```",output,1,751
sort the list of tuples `lst` by the sum of every value except the first and by the first value in reverse order,instruction,0,752
"```sorted(lst, key=lambda x: (sum(x[1:]), x[0]), reverse=True)```",output,1,752
"add header 'WWWAuthenticate' in a flask app with value 'Basic realm=""test""'",instruction,0,753
"```response.headers['WWW-Authenticate'] = 'Basic realm=""test""'```",output,1,753
clear session key 'mykey',instruction,0,754
```del request.session['mykey']```,output,1,754
convert date string '24052010' to date object in format '%d%m%Y',instruction,0,755
"```datetime.datetime.strptime('24052010', '%d%m%Y').date()```",output,1,755
Replace non-ASCII characters in string `text` with a single space,instruction,0,756
"```re.sub('[^\\x00-\\x7F]+', ' ', text)```",output,1,756
,instruction,0,757
"```numpy.array([[1, 2], [3, 4]])```",output,1,757
Get a list `myList` from 1 to 10,instruction,0,758
```myList = [i for i in range(10)]```,output,1,758
use regex pattern '((.+?)\\2+)' to split string '44442(2)2(2)44',instruction,0,759
```[m[0] for m in re.compile('((.+?)\\2+)').findall('44442(2)2(2)44')]```,output,1,759
use regular expression '((\\d)(?:[()]*\\2*[()]*)*)' to split string `s`,instruction,0,760
"```[i[0] for i in re.findall('((\\d)(?:[()]*\\2*[()]*)*)', s)]```",output,1,760
remove the space between subplots in matplotlib.pyplot,instruction,0,761
"```fig.subplots_adjust(wspace=0, hspace=0)```",output,1,761
Reverse list `x`,instruction,0,762
```x[::-1]```,output,1,762
,instruction,0,763
"```json.dumps({'apple': 'cat', 'banana': 'dog', 'pear': 'fish'})```",output,1,763
write a list of strings `row` to csv object `csvwriter`,instruction,0,764
```csvwriter.writerow(row)```,output,1,764
Jinja2 formate date `item.date` accorto pattern 'Y M d',instruction,0,765
```{{(item.date | date): 'Y M d'}}```,output,1,765
"Split a string `text` with comma, question mark or exclamation by non-consuming regex using look-behind",instruction,0,766
"```re.split('(?<=[\\.\\?!]) ', text)```",output,1,766
create a regular expression object with the pattern '\xe2\x80\x93',instruction,0,767
```re.compile('\xe2\x80\x93')```,output,1,767
declare an array `variable`,instruction,0,768
```variable = []```,output,1,768
declare an array with element 'i',instruction,0,769
```intarray = array('i')```,output,1,769
"given list `to_reverse`, reverse the all sublists and the list itself",instruction,0,770
```[sublist[::-1] for sublist in to_reverse[::-1]]```,output,1,770
,instruction,0,771
"```re.sub('[^0-9a-zA-Z]+', '*', 'h^&ell`.,|o w]{+orld')```",output,1,771
"unescape special characters without splitting data in array of strings `['I ', u'<', '3s U ', u'&', ' you luvz me']`",instruction,0,772
"```"""""""""""".join(['I ', '<', '3s U ', '&', ' you luvz me'])```",output,1,772
disable logging while running unit tests in python django,instruction,0,773
```logging.disable(logging.CRITICAL)```,output,1,773
adding url `url` to mysql row,instruction,0,774
"```cursor.execute('INSERT INTO index(url) VALUES(%s)', (url,))```",output,1,774
convert column of date objects 'DateObj' in pandas dataframe `df` to strings in new column 'DateStr',instruction,0,775
```df['DateStr'] = df['DateObj'].dt.strftime('%d%m%Y')```,output,1,775
split string `s` by '@' and get the first element,instruction,0,776
```s.split('@')[0]```,output,1,776
drop rows of dataframe `df` whose index is smaller than the value of `start_remove` or bigger than the value of`end_remove`,instruction,0,777
```df.query('index < @start_remove or index > @end_remove')```,output,1,777
Drop the rows in pandas timeseries `df` from the row containing index `start_remove` to the row containing index `end_remove`,instruction,0,778
```df.loc[(df.index < start_remove) | (df.index > end_remove)]```,output,1,778
Get the number of NaN values in each column of dataframe `df`,instruction,0,779
```df.isnull().sum()```,output,1,779
reset index of dataframe `df`so that existing index values are transferred into `df`as columns,instruction,0,780
```df.reset_index(inplace=True)```,output,1,780
generate a list containing values associated with the key 'value' of each dictionary inside list `list_of_dicts`,instruction,0,781
```[x['value'] for x in list_of_dicts]```,output,1,781
,instruction,0,782
```[d['value'] for d in l]```,output,1,782
,instruction,0,783
```[d['value'] for d in l if 'value' in d]```,output,1,783
convert numpy array into python list structure,instruction,0,784
"```np.array([[1, 2, 3], [4, 5, 6]]).tolist()```",output,1,784
"converting string '(1,2,3,4)' to a tuple",instruction,0,785
"```ast.literal_eval('(1,2,3,4)')```",output,1,785
keep a list `dataList` of lists sorted as it is created by second element,instruction,0,786
```dataList.sort(key=lambda x: x[1])```,output,1,786
remove duplicated items from list of lists `testdata`,instruction,0,787
"```list(map(list, set(map(lambda i: tuple(i), testdata))))```",output,1,787
uniqueness for list of lists `testdata`,instruction,0,788
```[list(i) for i in set(tuple(i) for i in testdata)]```,output,1,788
"in django, check if a user is in a group 'Member'",instruction,0,789
```return user.groups.filter(name='Member').exists()```,output,1,789
"check if a user `user` is in a group from list of groups `['group1', 'group2']`",instruction,0,790
"```return user.groups.filter(name__in=['group1', 'group2']).exists()```",output,1,790
Change log level dynamically to 'DEBUG' without restarting the application,instruction,0,791
```logging.getLogger().setLevel(logging.DEBUG)```,output,1,791
"Concat each values in a tuple `(34.2424, -64.2344, 76.3534, 45.2344)` to get a string",instruction,0,792
"```"""""""""""".join(str(i) for i in (34.2424, -64.2344, 76.3534, 45.2344))```",output,1,792
swap each pair of characters in string `s`,instruction,0,793
"```"""""""""""".join([s[x:x + 2][::-1] for x in range(0, len(s), 2)])```",output,1,793
save current figure to file 'graph.png' with resolution of 1000 dpi,instruction,0,794
"```plt.savefig('graph.png', dpi=1000)```",output,1,794
delete items from list `my_list` if the item exist in list `to_dell`,instruction,0,795
```my_list = [[x for x in sublist if x not in to_del] for sublist in my_list]```,output,1,795
find all the elements that consists value '1' in a list of tuples 'a',instruction,0,796
```[item for item in a if 1 in item]```,output,1,796
find all elements in a list of tuples `a` where the first element of each tuple equals 1,instruction,0,797
```[item for item in a if item[0] == 1]```,output,1,797
Get the index value in list `p_list` using enumerate in list comprehension,instruction,0,798
"```{p.id: {'id': p.id, 'position': ind} for ind, p in enumerate(p_list)}```",output,1,798
,instruction,0,799
```[dict(y) for y in set(tuple(x.items()) for x in d)]```,output,1,799
load a file `file.py` into the python console,instruction,0,800
"```exec(compile(open('file.py').read(), 'file.py', 'exec'))```",output,1,800
SQLAlchemy count the number of rows in table `Congress`,instruction,0,801
```rows = session.query(Congress).count()```,output,1,801
,instruction,0,802
"```subprocess.call(['test.sh', str(domid)])```",output,1,802
read excel file `file_name` using pandas,instruction,0,803
"```dfs = pd.read_excel(file_name, sheetname=None)```",output,1,803
unpack the binary data represented by the hexadecimal string '4081637ef7d0424a' to a float,instruction,0,804
"```struct.unpack('d', binascii.unhexlify('4081637ef7d0424a'))```",output,1,804
Get index of numpy array `a` with another numpy array `b`,instruction,0,805
```a[tuple(b)]```,output,1,805
"find all possible sequences of elements in a list `[2, 3, 4]`",instruction,0,806
"```map(list, permutations([2, 3, 4]))```",output,1,806
sort a list `unsorted_list` based on another sorted list `presorted_list`,instruction,0,807
"```sorted(unsorted_list, key=presorted_list.index)```",output,1,807
,instruction,0,808
```datetime.datetime.now() - datetime.timedelta(days=1)```,output,1,808
create a dataframe `d` filled with zeros with indices from 0 to length of `data` and column names from `feature_list`,instruction,0,809
"```d = pd.DataFrame(0, index=np.arange(len(data)), columns=feature_list)```",output,1,809
find the index of sub string 'World' in `x`,instruction,0,810
```x.find('World')```,output,1,810
find the index of sub string 'Aloha' in `x`,instruction,0,811
```x.find('Aloha')```,output,1,811
find the index of sub string 'cc' in string 'sdfasdf',instruction,0,812
```'sdfasdf'.index('cc')```,output,1,812
find the index of sub string 'df' in string 'sdfasdf',instruction,0,813
```'sdfasdf'.index('df')```,output,1,813
find the index of sub string 'a' in string `str`,instruction,0,814
```str.find('a')```,output,1,814
find the index of sub string 'g' in string `str`,instruction,0,815
```str.find('g')```,output,1,815
find the index of sub string 's' in string `str` starting from index 11,instruction,0,816
"```str.find('s', 11)```",output,1,816
find the index of sub string 's' in string `str` starting from index 15,instruction,0,817
"```str.find('s', 15)```",output,1,817
find the index of sub string 's' in string `str` starting from index 16,instruction,0,818
"```str.find('s', 16)```",output,1,818
find the index of sub string 's' in string `str` starting from index 11 and ending at index 14,instruction,0,819
"```str.find('s', 11, 14)```",output,1,819
sort list of date strings 'd',instruction,0,820
"```sorted(d, key=lambda x: datetime.datetime.strptime(x, '%m-%Y'))```",output,1,820
Get all the sentences from a string `text` using regex,instruction,0,821
"```re.split('\\.\\s', text)```",output,1,821
,instruction,0,822
"```re.split('\\.\\s', re.sub('\\.\\s*$', '', text))```",output,1,822
get all characters in string 'foobar' up to the fourth index,instruction,0,823
"```""""""foobar""""""[:4]```",output,1,823
cut a string by delimiter '&',instruction,0,824
```s.rfind('&')```,output,1,824
cut a string using delimiter '&',instruction,0,825
```s[:s.rfind('&')]```,output,1,825
find a tag `option` whose `value` attribute is `state` in selenium,instruction,0,826
"```driver.find_element_by_xpath(""//option[@value='"" + state + ""']"").click()```",output,1,826
"append line ""appended text"" to file ""test.txt""",instruction,0,827
"```with open('test.txt', 'a') as myfile:
    myfile.write('appended text')```",output,1,827
"append line ""cool beans..."" to file ""foo""",instruction,0,828
"```with open('foo', 'a') as f:
    f.write('cool beans...')```",output,1,828
append to file 'test1' content 'koko',instruction,0,829
"```with open('test1', 'ab') as f:
    pass```",output,1,829
append to file 'test' content 'koko',instruction,0,830
"```open('test', 'a+b').write('koko')```",output,1,830
split string 'x+13.5*10x-4e1' into tokens,instruction,0,831
"```print([i for i in re.split('([\\d.]+|\\W+)', 'x+13.5*10x-4e1') if i])```",output,1,831
Find all Chinese characters in string `ipath`,instruction,0,832
"```re.findall('[\u4e00-\u9fff]+', ipath)```",output,1,832
split string `s` by letter 's',instruction,0,833
```s.split('s')```,output,1,833
run shell command 'rm -r some.file' in the background,instruction,0,834
"```subprocess.Popen(['rm', '-r', 'some.file'])```",output,1,834
convert a list of dictionaries `listofdict into a dictionary of dictionaries,instruction,0,835
"```dict((d['name'], d) for d in listofdict)```",output,1,835
print current date and time in a regular format,instruction,0,836
```datetime.datetime.now().strftime('%Y-%m-%d %H:%M')```,output,1,836
print current date and time in a regular format,instruction,0,837
```time.strftime('%Y-%m-%d %H:%M')```,output,1,837
find consecutive consonants in a word `CONCENTRATION` using regex,instruction,0,838
"```re.findall('[bcdfghjklmnpqrstvwxyz]+', 'CONCERTATION', re.IGNORECASE)```",output,1,838
get a list of indices of non zero elements in a list `a`,instruction,0,839
"```[i for i, e in enumerate(a) if e != 0]```",output,1,839
get multiple integer values from a string 'string1',instruction,0,840
"```map(int, re.findall('\\d+', string1))```",output,1,840
get the path of Python executable under windows,instruction,0,841
```os.path.dirname(sys.executable)```,output,1,841
move an x-axis label to the top of a plot `ax` in matplotlib,instruction,0,842
```ax.xaxis.set_label_position('top')```,output,1,842
move x-axis to the top of a plot `ax`,instruction,0,843
```ax.xaxis.tick_top()```,output,1,843
Move x-axis of the pyplot object `ax` to the top of a plot in matplotlib,instruction,0,844
```ax.xaxis.set_ticks_position('top')```,output,1,844
parse string '2015/01/01 12:12am' to DateTime object using format '%Y/%m/%d %I:%M%p',instruction,0,845
"```datetime.strptime('2015/01/01 12:12am', '%Y/%m/%d %I:%M%p')```",output,1,845
Open image 'picture.jpg',instruction,0,846
"```img = Image.open('picture.jpg')
img.show()```",output,1,846
"Open image ""picture.jpg""",instruction,0,847
"```img = Image.open('picture.jpg')
Img.show```",output,1,847
terminate the script using status value 0,instruction,0,848
```sys.exit(0)```,output,1,848
abort the execution of the script using message 'aa! errors!',instruction,0,849
```sys.exit('aa! errors!')```,output,1,849
abort the execution of a python script,instruction,0,850
```sys.exit()```,output,1,850
find maximum with lookahead = 4 in a list `arr`,instruction,0,851
"```[max(abs(x) for x in arr[i:i + 4]) for i in range(0, len(arr), 4)]```",output,1,851
set the current working directory to 'c:\\Users\\uname\\desktop\\python',instruction,0,852
```os.chdir('c:\\Users\\uname\\desktop\\python')```,output,1,852
set the current working directory to path `path`,instruction,0,853
```os.chdir(path)```,output,1,853
get a list `no_integers` of all the items in list `mylist` that are not of type `int`,instruction,0,854
"```no_integers = [x for x in mylist if not isinstance(x, int)]```",output,1,854
match contents of an element to 'Example' in xpath (lxml),instruction,0,855
"```tree.xpath("".//a[text()='Example']"")[0].tag```",output,1,855
"concatenate key/value pairs in dictionary `a` with string ', ' into a single string",instruction,0,856
"```"""""", """""".join([(str(k) + ' ' + str(v)) for k, v in list(a.items())])```",output,1,856
"Strip all non-ASCII characters from a unicode string, `\xa3\u20ac\xa3\u20ac`",instruction,0,857
"```print(set(re.sub('[\x00-\x7f]', '', '\xa3\u20ac\xa3\u20ac')))```",output,1,857
Get all non-ascii characters in a unicode string `\xa3100 is worth more than \u20ac100`,instruction,0,858
"```print(re.sub('[\x00-\x7f]', '', '\xa3100 is worth more than \u20ac100'))```",output,1,858
"build a dict of key:value pairs from a string representation of a dict, `{'muffin' : 'lolz', 'foo' : 'kitty'}`",instruction,0,859
"```ast.literal_eval(""{'muffin' : 'lolz', 'foo' : 'kitty'}"")```",output,1,859
Print string `t` with proper unicode representations,instruction,0,860
```print(t.decode('unicode_escape'))```,output,1,860
Normalize string `str` from 'cp1252' code to 'utf-8' code,instruction,0,861
```print(str.encode('cp1252').decode('utf-8').encode('cp1252').decode('utf-8'))```,output,1,861
merge lists `list_a` and `list_b` into a list of tuples,instruction,0,862
"```zip(list_a, list_b)```",output,1,862
merge lists `a` and `a` into a list of tuples,instruction,0,863
"```list(zip(a, b))```",output,1,863
convert pandas DataFrame `df` to a dictionary using `id` field as the key,instruction,0,864
```df.set_index('id').to_dict()```,output,1,864
"convert pandas dataframe `df` with fields 'id', 'value' to dictionary",instruction,0,865
```df.set_index('id')['value'].to_dict()```,output,1,865
,instruction,0,866
"```sorted(list(mydict.items()), key=lambda a: map(int, a[0].split('.')))```",output,1,866
remove parentheses and text within it in string `filename`,instruction,0,867
"```re.sub('\\([^)]*\\)', '', filename)```",output,1,867
Check if string 'a b' only contains letters and spaces,instruction,0,868
"```""""""a b"""""".replace(' ', '').isalpha()```",output,1,868
sum each element `x` in list `first` with element `y` at the same index in list `second`.,instruction,0,869
"```[(x + y) for x, y in zip(first, second)]```",output,1,869
sort a python dictionary `a_dict` by element `1` of the value,instruction,0,870
"```sorted(list(a_dict.items()), key=lambda item: item[1][1])```",output,1,870
,instruction,0,871
```re.compile('[^a-zA-Z0-9-]+')```,output,1,871
get index of the biggest 2 values of a list `a`,instruction,0,872
"```sorted(list(range(len(a))), key=lambda i: a[i])[-2:]```",output,1,872
get indexes of the largest `2` values from a list `a` using itemgetter,instruction,0,873
"```zip(*sorted(enumerate(a), key=operator.itemgetter(1)))[0][-2:]```",output,1,873
get the indexes of the largest `2` values from a list of integers `a`,instruction,0,874
"```sorted(list(range(len(a))), key=lambda i: a[i], reverse=True)[:2]```",output,1,874
get index of key 'c' in dictionary `x`,instruction,0,875
```list(x.keys()).index('c')```,output,1,875
Print +1 using format '{0:+d}',instruction,0,876
```print('{0:+d}'.format(score))```,output,1,876
"remove adjacent duplicate elements from a list `[1, 2, 2, 3, 2, 2, 4]`",instruction,0,877
"```[k for k, g in itertools.groupby([1, 2, 2, 3, 2, 2, 4])]```",output,1,877
"split string ""0,1,2"" based on delimiter ','",instruction,0,878
"```""""""0,1,2"""""".split(',')```",output,1,878
"convert the string '0,1,2' to a list of integers",instruction,0,879
"```[int(x) for x in '0,1,2'.split(',')]```",output,1,879
"convert list of key-value tuples `[('A', 1), ('B', 2), ('C', 3)]` into dictionary",instruction,0,880
"```dict([('A', 1), ('B', 2), ('C', 3)])```",output,1,880
save numpy array `x` into text file 'test.txt',instruction,0,881
"```np.savetxt('test.txt', x)```",output,1,881
store the output of command 'ls' in variable `direct_output`,instruction,0,882
"```direct_output = subprocess.check_output('ls', shell=True)```",output,1,882
get all column name of dataframe `df` except for column 'T1_V6',instruction,0,883
```df[df.columns - ['T1_V6']]```,output,1,883
get count of values in numpy array `a` that are between values `25` and `100`,instruction,0,884
```((25 < a) & (a < 100)).sum()```,output,1,884
Get day name from a datetime object,instruction,0,885
```date.today().strftime('%A')```,output,1,885
,instruction,0,886
"```re.search('\\bis\\b', your_string)```",output,1,886
Jinja parse datetime object `car.date_of_manufacture` to use format pattern `datetime`,instruction,0,887
```{{car.date_of_manufacture | datetime}}```,output,1,887
Get the date object `date_of_manufacture` of object `car` in string  format '%Y-%m-%d',instruction,0,888
```{{car.date_of_manufacture.strftime('%Y-%m-%d')}}```,output,1,888
make a flat list from list of lists `sublist`,instruction,0,889
```[item for sublist in l for item in sublist]```,output,1,889
make a flat list from list of lists `list2d`,instruction,0,890
```list(itertools.chain(*list2d))```,output,1,890
make a flat list from list of lists `list2d`,instruction,0,891
```list(itertools.chain.from_iterable(list2d))```,output,1,891
convert ascii value 'a' to int,instruction,0,892
```ord('a')```,output,1,892
replace white spaces in string '  a\n b\n c\nd  e' with empty string '',instruction,0,893
"```re.sub('(?m)^[^\\S\\n]+', '', '  a\n b\n c\nd  e')```",output,1,893
remove white spaces from all the lines using a regular expression in string 'a\n b\n c',instruction,0,894
"```re.sub('(?m)^\\s+', '', 'a\n b\n c')```",output,1,894
"destruct elements of list `[1, 2, 3]` to variables `a`, `b` and `c`",instruction,0,895
"```a, b, c = [1, 2, 3]```",output,1,895
split list `mylist` into a list of lists whose elements have the same first five characters,instruction,0,896
"```[list(v) for k, v in itertools.groupby(mylist, key=lambda x: x[:5])]```",output,1,896
remove all instances of parenthesesis containing text beginning with `as ` from string `line`,instruction,0,897
"```line = re.sub('\\(+as .*?\\) ', '', line)```",output,1,897
skip the newline while printing `line`,instruction,0,898
```print(line.rstrip('\n'))```,output,1,898
get index values of pandas dataframe `df` as list,instruction,0,899
```df.index.values.tolist()```,output,1,899
check if list `a` is empty,instruction,0,900
"```if (not a):
    pass```",output,1,900
check if list `seq` is empty,instruction,0,901
"```if (not seq):
    pass```",output,1,901
check if list `li` is empty,instruction,0,902
"```if (len(li) == 0):
    pass```",output,1,902
create a list containing the indices of elements greater than 4 in list `a`,instruction,0,903
"```[i for i, v in enumerate(a) if v > 4]```",output,1,903
reverse list `yourdata`,instruction,0,904
"```sorted(yourdata, reverse=True)```",output,1,904
sort list of nested dictionaries `yourdata` in reverse based on values associated with each dictionary's key 'subkey',instruction,0,905
"```sorted(yourdata, key=lambda d: d.get('key', {}).get('subkey'), reverse=True)```",output,1,905
sort list of nested dictionaries `yourdata` in reverse order of 'key' and 'subkey',instruction,0,906
"```yourdata.sort(key=lambda e: e['key']['subkey'], reverse=True)```",output,1,906
remove decimal points in pandas data frame using round,instruction,0,907
```df.round()```,output,1,907
Get data from matplotlib plot,instruction,0,908
```gca().get_lines()[n].get_xydata()```,output,1,908
get the maximum 2 values per row in array `A`,instruction,0,909
"```A[:, -2:]```",output,1,909
"Get value for  ""username"" parameter in GET request  in Django",instruction,0,910
"```request.GET.get('username', '')```",output,1,910
pretty-print ordered dictionary `o`,instruction,0,911
```pprint(dict(list(o.items())))```,output,1,911
Confirm urls in Django properly,instruction,0,912
"```url('^$', include('sms.urls')),```",output,1,912
Configure url in django properly,instruction,0,913
"```url('^', include('sms.urls')),```",output,1,913
get the tuple in list `a_list` that has the largest item in the second index,instruction,0,914
"```max_item = max(a_list, key=operator.itemgetter(1))```",output,1,914
find tuple in list of tuples `a_list` with the largest second element,instruction,0,915
"```max(a_list, key=operator.itemgetter(1))```",output,1,915
resample series `s` into 3 months bins and sum each bin,instruction,0,916
"```s.resample('3M', how='sum')```",output,1,916
"extract elements at indices (1, 2, 5) from a list `a`",instruction,0,917
"```[a[i] for i in (1, 2, 5)]```",output,1,917
filter lines from a text file 'textfile' which contain a word 'apple',instruction,0,918
```[line for line in open('textfile') if 'apple' in line]```,output,1,918
convert a date string `s` to a datetime object,instruction,0,919
"```datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ')```",output,1,919
reading tab-delimited csv file `filename` with pandas on mac,instruction,0,920
"```pandas.read_csv(filename, sep='\t', lineterminator='\r')```",output,1,920
replace only first occurence of string `TEST` from a string `longlongTESTstringTEST`,instruction,0,921
"```'longlongTESTstringTEST'.replace('TEST', '?', 1)```",output,1,921
zip file `pdffile` using its basename as directory name,instruction,0,922
"```archive.write(pdffile, os.path.basename(pdffile))```",output,1,922
create a dictionary of pairs from a list of tuples `myListOfTuples`,instruction,0,923
```dict(x[1:] for x in reversed(myListOfTuples))```,output,1,923
subtract elements of list `List1` from elements of list `List2`,instruction,0,924
"```[(x1 - x2) for x1, x2 in zip(List1, List2)]```",output,1,924
check if string `string` starts with a number,instruction,0,925
```string[0].isdigit()```,output,1,925
"Check if string `strg` starts with any of the elements in list ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')",instruction,0,926
"```strg.startswith(('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'))```",output,1,926
print script's directory,instruction,0,927
```print(os.path.dirname(os.path.realpath(__file__)))```,output,1,927
"split string `text` by the occurrences of regex pattern '(?<=\\?|!|\\.)\\s{0,2}(?=[A-Z]|$)'",instruction,0,928
"```re.split('(?<=\\?|!|\\.)\\s{0,2}(?=[A-Z]|$)', text)```",output,1,928
Make a scatter plot using unpacked values of list `li`,instruction,0,929
```plt.scatter(*zip(*li))```,output,1,929
rearrange tuple of tuples `t`,instruction,0,930
```tuple(zip(*t))```,output,1,930
Get average for every three columns in `df` dataframe,instruction,0,931
"```df.groupby(np.arange(len(df.columns)) // 3, axis=1).mean()```",output,1,931
convert a list `L` of ascii values to a string,instruction,0,932
"```"""""""""""".join(chr(i) for i in L)```",output,1,932
count the number of pairs in dictionary `d` whose value equal to `chosen_value`,instruction,0,933
```sum(x == chosen_value for x in list(d.values()))```,output,1,933
count the number of values in `d` dictionary that are predicate to function `some_condition`,instruction,0,934
```sum(1 for x in list(d.values()) if some_condition(x))```,output,1,934
convert double 0.00582811585976 to float,instruction,0,935
"```struct.unpack('f', struct.pack('f', 0.00582811585976))```",output,1,935
convert datetime.date `dt` to utc timestamp,instruction,0,936
"```timestamp = (dt - datetime(1970, 1, 1)).total_seconds()```",output,1,936
sort column `m` in panda dataframe `df`,instruction,0,937
```df.sort('m')```,output,1,937
Sort a data `a` in descending order based on the `modified` attribute of elements using lambda function,instruction,0,938
"```a = sorted(a, key=lambda x: x.modified, reverse=True)```",output,1,938
print the truth value of `a`,instruction,0,939
```print(bool(a))```,output,1,939
rename `last` row index label in dataframe `df` to `a`,instruction,0,940
```df = df.rename(index={last: 'a'})```,output,1,940
Fit Kmeans function to a one-dimensional array `x` by reshaping it to be a multidimensional array of single values,instruction,0,941
"```km.fit(x.reshape(-1, 1))```",output,1,941
Sort a list of strings 'words' such that items starting with 's' come first.,instruction,0,942
"```sorted(words, key=lambda x: 'a' + x if x.startswith('s') else 'b' + x)```",output,1,942
open the login site 'http://somesite.com/adminpanel/index.php' in the browser,instruction,0,943
```webbrowser.open('http://somesite.com/adminpanel/index.php')```,output,1,943
"fetch all elements in a dictionary `parent_dict`, falling between two keys 2 and 4",instruction,0,944
"```dict((k, v) for k, v in parent_dict.items() if 2 < k < 4)```",output,1,944
fetch all elements in a dictionary 'parent_dict' where the key is between the range of 2 to 4,instruction,0,945
"```dict((k, v) for k, v in parent_dict.items() if k > 2 and k < 4)```",output,1,945
sort two lists `list1` and `list2` together using lambda function,instruction,0,946
"```[list(x) for x in zip(*sorted(zip(list1, list2), key=lambda pair: pair[0]))]```",output,1,946
get the number of values in list `j` that is greater than 5,instruction,0,947
```sum(((i > 5) for i in j))```,output,1,947
get the number of values in list `j` that is greater than 5,instruction,0,948
```len([1 for i in j if (i > 5)])```,output,1,948
get the number of values in list `j` that is greater than `i`,instruction,0,949
"```j = np.array(j)
sum((j > i))```",output,1,949
"zip list `a`, `b`, `c` into a list of tuples",instruction,0,950
"```[(x + tuple(y)) for x, y in zip(zip(a, b), c)]```",output,1,950
changing permission of file `path` to `stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH`,instruction,0,951
"```os.chmod(path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)```",output,1,951
argparse associate zero or more arguments with flag 'file',instruction,0,952
"```parser.add_argument('file', nargs='*')```",output,1,952
get a list of booleans `z` that shows wether the corresponding items in list `x` and `y` are equal,instruction,0,953
"```z = [(i == j) for i, j in zip(x, y)]```",output,1,953
create a list which indicates whether each element in `x` and `y` is identical,instruction,0,954
```[(x[i] == y[i]) for i in range(len(x))]```,output,1,954
,instruction,0,955
"```[int(s) for s in re.findall('\\b\\d+\\b', ""he33llo 42 I'm a 32 string 30"")]```",output,1,955
create an empty data frame `df2` with index from another data frame `df1`,instruction,0,956
```df2 = pd.DataFrame(index=df1.index)```,output,1,956
unpack first and second bytes of byte string `pS` into integer,instruction,0,957
"```struct.unpack('h', pS[0:2])```",output,1,957
print list `t` into a table-like shape,instruction,0,958
"```print('\n'.join('  '.join(map(str, row)) for row in t))```",output,1,958
,instruction,0,959
```df.sort_values(by='Date')```,output,1,959
check if a checkbox is checked in selenium python webdriver,instruction,0,960
```driver.find_element_by_name('<check_box_name>').is_selected()```,output,1,960
determine if checkbox with id '<check_box_id>' is checked in selenium python webdriver,instruction,0,961
```driver.find_element_by_id('<check_box_id>').is_selected()```,output,1,961
"replace `0` with `2` in the list `[0, 1, 0, 3]`",instruction,0,962
"```[(a if a else 2) for a in [0, 1, 0, 3]]```",output,1,962
Produce a string that is suitable as Unicode literal from string 'M\\N{AMPERSAND}M\\N{APOSTROPHE}s',instruction,0,963
```'M\\N{AMPERSAND}M\\N{APOSTROPHE}s'.encode().decode('unicode-escape')```,output,1,963
Parse a unicode string `M\\N{AMPERSAND}M\\N{APOSTROPHE}s`,instruction,0,964
```'M\\N{AMPERSAND}M\\N{APOSTROPHE}s'.decode('unicode-escape')```,output,1,964
convert Unicode codepoint to utf8 hex,instruction,0,965
"```chr(int('fd9b', 16)).encode('utf-8')```",output,1,965
use upper case letters to print hex value `value`,instruction,0,966
```print('0x%X' % value)```,output,1,966
get a list `cleaned` that contains all non-empty elements in list `your_list`,instruction,0,967
```cleaned = [x for x in your_list if x]```,output,1,967
create a slice object using string `string_slice`,instruction,0,968
```slice(*[(int(i.strip()) if i else None) for i in string_slice.split(':')])```,output,1,968
Find all the tags `a` and `div` from Beautiful Soup object `soup`,instruction,0,969
"```soup.find_all(['a', 'div'])```",output,1,969
get the name of function `func` as a string,instruction,0,970
```print(func.__name__)```,output,1,970
convert dictionary `adict` into string,instruction,0,971
"```"""""""""""".join('{}{}'.format(key, val) for key, val in sorted(adict.items()))```",output,1,971
convert dictionary `adict` into string,instruction,0,972
"```"""""""""""".join('{}{}'.format(key, val) for key, val in list(adict.items()))```",output,1,972
copy list `old_list` as `new_list`,instruction,0,973
```new_list = old_list[:]```,output,1,973
copy list `old_list` as `new_list`,instruction,0,974
```new_list = list(old_list)```,output,1,974
copy list `old_list` as `new_list`,instruction,0,975
```new_list = copy.copy(old_list)```,output,1,975
deep copy list `old_list` as `new_list`,instruction,0,976
```new_list = copy.deepcopy(old_list)```,output,1,976
make a copy of list `old_list`,instruction,0,977
```[i for i in old_list]```,output,1,977
remove frame of legend in plot `plt`,instruction,0,978
```plt.legend(frameon=False)```,output,1,978
Print a emoji from a string `\\ud83d\\ude4f` having surrogate pairs,instruction,0,979
"```""""""\\ud83d\\ude4f"""""".encode('utf-16', 'surrogatepass').decode('utf-16')```",output,1,979
calling a function named 'myfunction' in the module,instruction,0,980
```globals()['myfunction']()```,output,1,980
"Check the status code of url ""http://www.stackoverflow.com""",instruction,0,981
```urllib.request.urlopen('http://www.stackoverflow.com').getcode()```,output,1,981
"Check the status code of url ""www.python.org""",instruction,0,982
"```conn = httplib.HTTPConnection('www.python.org')
conn.request('HEAD', '/')
r1 = conn.getresponse()
print(r1.status, r1.reason)```",output,1,982
Check the status code of url `url`,instruction,0,983
"```r = requests.head(url)
return (r.status_code == 200)```",output,1,983
"Checking if website ""http://www.stackoverflow.com"" is up",instruction,0,984
```print(urllib.request.urlopen('http://www.stackoverflow.com').getcode())```,output,1,984
"Selenium `driver` click a hyperlink with the pattern ""a[href^='javascript']""",instruction,0,985
"```driver.find_element_by_css_selector(""a[href^='javascript']"").click()```",output,1,985
"store data frame `df` to file `file_name` using pandas, python",instruction,0,986
```df.to_pickle(file_name)```,output,1,986
calculate the mean of columns with same name in dataframe `df`,instruction,0,987
"```df.groupby(by=df.columns, axis=1).mean()```",output,1,987
sort list `bar` by each element's attribute `attrb1` and attribute `attrb2` in reverse order,instruction,0,988
"```bar.sort(key=lambda x: (x.attrb1, x.attrb2), reverse=True)```",output,1,988
get alpha value `alpha` of a png image `img`,instruction,0,989
```alpha = img.split()[-1]```,output,1,989
,instruction,0,990
```[len(x) for x in s.split()]```,output,1,990
BeautifulSoup find tag 'div' with styling 'width=300px;' in HTML string `soup`,instruction,0,991
"```soup.findAll('div', style='width=300px;')```",output,1,991
Execute SQL statement `sql` with values of dictionary `myDict` as parameters,instruction,0,992
"```cursor.execute(sql, list(myDict.values()))```",output,1,992
Convert CSV file `Result.csv` to Pandas dataframe using separator ' ',instruction,0,993
"```df.to_csv('Result.csv', index=False, sep=' ')```",output,1,993
update the `globals()` dictionary with the contents of the `vars(args)` dictionary,instruction,0,994
```globals().update(vars(args))```,output,1,994
find all substrings in `mystring` beginning and ending with square brackets,instruction,0,995
"```re.findall('\\[(.*?)\\]', mystring)```",output,1,995
"Format all floating variables `var1`, `var2`, `var3`, `var1` to print to two decimal places.",instruction,0,996
"```print('%.2f kg = %.2f lb = %.2f gal = %.2f l' % (var1, var2, var3, var4))```",output,1,996
Remove all items from a dictionary `d` where the values are less than `1`,instruction,0,997
"```d = dict((k, v) for k, v in d.items() if v > 0)```",output,1,997
Filter dictionary `d` to have items with value greater than 0,instruction,0,998
"```d = {k: v for k, v in list(d.items()) if v > 0}```",output,1,998
convert a string of date strings `date_stngs ` to datetime objects and put them in a dataframe,instruction,0,999
```pd.to_datetime(pd.Series(date_stngs))```,output,1,999
"get  value at index `[2, 0]` in dataframe `df`",instruction,0,1000
"```df.iloc[2, 0]```",output,1,1000
change the font size on plot `matplotlib` to 22,instruction,0,1001
```matplotlib.rcParams.update({'font.size': 22})```,output,1,1001
converting dictionary `d` into a dataframe `pd` with keys as data for column 'Date' and the corresponding values as data for column 'DateValue',instruction,0,1002
"```pd.DataFrame(list(d.items()), columns=['Date', 'DateValue'])```",output,1,1002
create a dataframe containing the multiplication of element-wise in dataframe `df` and dataframe `df2` using index name and column labels of dataframe `df`,instruction,0,1003
"```pd.DataFrame(df.values * df2.values, columns=df.columns, index=df.index)```",output,1,1003
extract floating number from string 'Current Level: 13.4 db.',instruction,0,1004
"```re.findall('\\d+\\.\\d+', 'Current Level: 13.4 db.')```",output,1,1004
extract floating point numbers from a string 'Current Level: -13.2 db or 14.2 or 3',instruction,0,1005
"```re.findall('[-+]?\\d*\\.\\d+|\\d+', 'Current Level: -13.2 db or 14.2 or 3')```",output,1,1005
pair each element in list `it` 3 times into a tuple,instruction,0,1006
"```zip(it, it, it)```",output,1,1006
lowercase a python dataframe string in column 'x' if it has missing values in dataframe `df`,instruction,0,1007
```df['x'].str.lower()```,output,1,1007
"append dict `{'f': var6, 'g': var7, 'h': var8}` to value of key `e` in dict `jsobj['a']['b']`",instruction,0,1008
"```jsobj['a']['b']['e'].append({'f': var6, 'g': var7, 'h': var8})```",output,1,1008
Concat a list of strings `lst` using string formatting,instruction,0,1009
"```"""""""""""".join(lst)```",output,1,1009
sum values greater than 0 in dictionary `d`,instruction,0,1010
```sum(v for v in list(d.values()) if v > 0)```,output,1,1010
run flask application `app` in debug mode.,instruction,0,1011
```app.run(debug=True)```,output,1,1011
"drop rows whose index value in list `[1, 3]` in dataframe `df`",instruction,0,1012
"```df.drop(df.index[[1, 3]], inplace=True)```",output,1,1012
replace nan values in a pandas data frame with the average of columns,instruction,0,1013
"```df.apply(lambda x: x.fillna(x.mean()), axis=0)```",output,1,1013
extract attribute `my_attr` from each object in list `my_list`,instruction,0,1014
```[o.my_attr for o in my_list]```,output,1,1014
python get time stamp on file `file` in '%m/%d/%Y' format,instruction,0,1015
"```time.strftime('%m/%d/%Y', time.gmtime(os.path.getmtime(file)))```",output,1,1015
check if dictionary `subset` is a subset of dictionary `superset`,instruction,0,1016
```all(item in list(superset.items()) for item in list(subset.items()))```,output,1,1016
Convert integer elements in list `wordids` to strings,instruction,0,1017
```[str(wi) for wi in wordids]```,output,1,1017
Reset the indexes of a pandas data frame,instruction,0,1018
```df2 = df.reset_index()```,output,1,1018
format datetime in `dt` as string in format `'%m/%d/%Y`,instruction,0,1019
```dt.strftime('%m/%d/%Y')```,output,1,1019
format floating point number  `TotalAmount` to be rounded off to two decimal places and have a comma thousands' seperator,instruction,0,1020
"```print('Total cost is: ${:,.2f}'.format(TotalAmount))```",output,1,1020
sum the values in each row of every two adjacent columns in dataframe `df`,instruction,0,1021
"```df.groupby(np.arange(len(df.columns)) // 2 + 1, axis=1).sum().add_prefix('s')```",output,1,1021
create list `randomList` with 10 random floating point numbers between 0.0 and 1.0,instruction,0,1022
```randomList = [random.random() for _ in range(10)]```,output,1,1022
find href value that has string 'follow?page' inside it,instruction,0,1023
"```print(soup.find('a', href=re.compile('.*follow\\?page.*')))```",output,1,1023
immediately see output of print statement that doesn't end in a newline,instruction,0,1024
```sys.stdout.flush()```,output,1,1024
get a random key `country` and value `capital` form a dictionary `d`,instruction,0,1025
"```country, capital = random.choice(list(d.items()))```",output,1,1025
split string `Word to Split` into a list of characters,instruction,0,1026
```list('Word to Split')```,output,1,1026
Create a list containing words that contain vowel letter followed by the same vowel in file 'file.text',instruction,0,1027
"```[w for w in open('file.txt') if not re.search('[aeiou]{2}', w)]```",output,1,1027
Validate IP address using Regex,instruction,0,1028
"```pat = re.compile('^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$')```",output,1,1028
execute file 'filename.py',instruction,0,1029
"```exec(compile(open('filename.py').read(), 'filename.py', 'exec'))```",output,1,1029
SQLAlchemy count the number of rows with distinct values in column `name` of table `Tag`,instruction,0,1030
```session.query(Tag).distinct(Tag.name).group_by(Tag.name).count()```,output,1,1030
remove null columns in a dataframe `df`,instruction,0,1031
"```df = df.dropna(axis=1, how='all')```",output,1,1031
check if all lists in list `L` have three elements of integer 1,instruction,0,1032
```all(x.count(1) == 3 for x in L)```,output,1,1032
Get a list comparing two lists of tuples `l1` and `l2` if any first value in `l1` matches with first value in `l2`,instruction,0,1033
```[x[0] for x in l1 if any(x[0] == y[0] for y in l2)]```,output,1,1033
clear the textbox `text` in tkinter,instruction,0,1034
"```tex.delete('1.0', END)```",output,1,1034
Convert long int `myNumber` into date and time represented in the the string format '%Y-%m-%d %H:%M:%S',instruction,0,1035
```datetime.datetime.fromtimestamp(myNumber).strftime('%Y-%m-%d %H:%M:%S')```,output,1,1035
Spawn a process to run python script `myscript.py` in C++,instruction,0,1036
```system('python myscript.py')```,output,1,1036
sort a list `your_list` of class objects by their values for the attribute `anniversary_score`,instruction,0,1037
```your_list.sort(key=operator.attrgetter('anniversary_score'))```,output,1,1037
sort list `your_list` by the `anniversary_score` attribute of each object,instruction,0,1038
```your_list.sort(key=lambda x: x.anniversary_score)```,output,1,1038
"convert a tensor with list of constants `[1, 2, 3]` into a numpy array in tensorflow",instruction,0,1039
"```print(type(tf.Session().run(tf.constant([1, 2, 3]))))```",output,1,1039
convert list `a` from being consecutive sequences of tuples into a single sequence of elements,instruction,0,1040
```list(itertools.chain(*a))```,output,1,1040
Set value for key `a` in dict `count` to `0` if key `a` does not exist or if value is `none`,instruction,0,1041
"```count.setdefault('a', 0)```",output,1,1041
Do group by on `cluster` column in `df` and get its mean,instruction,0,1042
```df.groupby(['cluster']).mean()```,output,1,1042
get number in list `myList` closest in value to number `myNumber`,instruction,0,1043
"```min(myList, key=lambda x: abs(x - myNumber))```",output,1,1043
check if any of the items in  `search` appear in `string`,instruction,0,1044
```any(x in string for x in search)```,output,1,1044
search for occurrences of regex pattern `pattern` in string `url`,instruction,0,1045
```print(pattern.search(url).group(1))```,output,1,1045
factorize all string values in dataframe `s` into floats,instruction,0,1046
```(s.factorize()[0] + 1).astype('float')```,output,1,1046
Get a list `C` by subtracting values in one list `B` from corresponding values in another list `A`,instruction,0,1047
"```C = [(a - b) for a, b in zip(A, B)]```",output,1,1047
"derive the week start for the given week number and year ‘2011, 4, 0’",instruction,0,1048
"```datetime.datetime.strptime('2011, 4, 0', '%Y, %U, %w')```",output,1,1048
"convert a list of strings `['1', '-1', '1']` to a list of numbers",instruction,0,1049
"```map(int, ['1', '-1', '1'])```",output,1,1049
"create datetime object from ""16sep2012""",instruction,0,1050
"```datetime.datetime.strptime('16Sep2012', '%d%b%Y')```",output,1,1050
update fields in Django model `Book` with arguments in dictionary `d` where primary key is equal to `pk`,instruction,0,1051
```Book.objects.filter(pk=pk).update(**d)```,output,1,1051
update the fields in django model `Book` using dictionary `d`,instruction,0,1052
```Book.objects.create(**d)```,output,1,1052
print a digit `your_number` with exactly 2 digits after decimal,instruction,0,1053
```print('{0:.2f}'.format(your_number))```,output,1,1053
generate a 12-digit random number,instruction,0,1054
"```random.randint(100000000000, 999999999999)```",output,1,1054
generate a random 12-digit number,instruction,0,1055
"```int(''.join(str(random.randint(0, 9)) for _ in range(12)))```",output,1,1055
generate a random 12-digit number,instruction,0,1056
"```"""""""""""".join(str(random.randint(0, 9)) for _ in range(12))```",output,1,1056
generate a 12-digit random number,instruction,0,1057
"```'%0.12d' % random.randint(0, 999999999999)```",output,1,1057
remove specific elements in a numpy array `a`,instruction,0,1058
"```numpy.delete(a, index)```",output,1,1058
sort list `trial_list` based on values of dictionary `trail_dict`,instruction,0,1059
"```sorted(trial_list, key=lambda x: trial_dict[x])```",output,1,1059
read a single character from stdin,instruction,0,1060
```sys.stdin.read(1)```,output,1,1060
get a list of characters in string `x` matching regex pattern `pattern`,instruction,0,1061
"```print(re.findall(pattern, x))```",output,1,1061
get the context of a search by keyword 'My keywords' in beautifulsoup `soup`,instruction,0,1062
```k = soup.find(text=re.compile('My keywords')).parent.text```,output,1,1062
convert rows in pandas data frame `df` into list,instruction,0,1063
"```df.apply(lambda x: x.tolist(), axis=1)```",output,1,1063
convert a 1d `A` array to a 2d array `B`,instruction,0,1064
"```B = np.reshape(A, (-1, 2))```",output,1,1064
run app `app` on host '192.168.0.58' and port 9000 in Flask,instruction,0,1065
"```app.run(host='192.168.0.58', port=9000, debug=False)```",output,1,1065
encode unicode string '\xc5\xc4\xd6' to utf-8 code,instruction,0,1066
```print('\xc5\xc4\xd6'.encode('UTF8'))```,output,1,1066
get the first element of each tuple from a list of tuples `G`,instruction,0,1067
```[x[0] for x in G]```,output,1,1067
regular expression matching all but 'aa' and 'bb' for string `string`,instruction,0,1068
"```re.findall('-(?!aa-|bb-)([^-]+)', string)```",output,1,1068
regular expression matching all but 'aa' and 'bb',instruction,0,1069
"```re.findall('-(?!aa|bb)([^-]+)', string)```",output,1,1069
remove false entries from a dictionary `hand`,instruction,0,1070
"```{k: v for k, v in list(hand.items()) if v}```",output,1,1070
Get a dictionary from a dictionary `hand` where the values are present,instruction,0,1071
"```dict((k, v) for k, v in hand.items() if v)```",output,1,1071
sort list `L` based on the value of variable 'resultType' for each object in list `L`,instruction,0,1072
"```sorted(L, key=operator.itemgetter('resultType'))```",output,1,1072
sort a list of objects `s` by a member variable 'resultType',instruction,0,1073
```s.sort(key=operator.attrgetter('resultType'))```,output,1,1073
sort a list of objects 'somelist' where the object has member number variable `resultType`,instruction,0,1074
```somelist.sort(key=lambda x: x.resultType)```,output,1,1074
"join multiple dataframes `d1`, `d2`, and `d3` on column 'name'",instruction,0,1075
"```df1.merge(df2, on='name').merge(df3, on='name')```",output,1,1075
generate random Decimal,instruction,0,1076
```decimal.Decimal(random.randrange(10000)) / 100```,output,1,1076
list all files of a directory `mypath`,instruction,0,1077
"```onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]```",output,1,1077
list all files of a directory `mypath`,instruction,0,1078
"```f = []
for (dirpath, dirnames, filenames) in walk(mypath):
    f.extend(filenames)
    break```",output,1,1078
"list all "".txt"" files of a directory ""/home/adam/""",instruction,0,1079
```print(glob.glob('/home/adam/*.txt'))```,output,1,1079
"list all files of a directory ""somedirectory""",instruction,0,1080
```os.listdir('somedirectory')```,output,1,1080
"execute sql query 'INSERT INTO table VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)' with all parameters in list `tup`",instruction,0,1081
"```cur.executemany('INSERT INTO table VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)', tup)```",output,1,1081
get keys with same value in dictionary `d`,instruction,0,1082
```print([key for key in d if d[key] == 1])```,output,1,1082
get keys with same value in dictionary `d`,instruction,0,1083
"```print([key for key, value in d.items() if value == 1])```",output,1,1083
Get keys from a dictionary 'd' where the value is '1'.,instruction,0,1084
"```print([key for key, value in list(d.items()) if value == 1])```",output,1,1084
create list of 'size' empty strings,instruction,0,1085
```strs = ['' for x in range(size)]```,output,1,1085
generate pdf file `output_filename` from markdown file `input_filename`,instruction,0,1086
"```with open(input_filename, 'r') as f:
    html_text = markdown(f.read(), output_format='html4')
pdfkit.from_string(html_text, output_filename)```",output,1,1086
remove duplicate dict in list `l`,instruction,0,1087
```[dict(t) for t in set([tuple(d.items()) for d in l])]```,output,1,1087
Set time zone `Europe/Istanbul` in Django,instruction,0,1088
```TIME_ZONE = 'Europe/Istanbul'```,output,1,1088
"append `date` to list value of `key` in dictionary `dates_dict`, or create key `key` with value `date` in a list if it does not exist",instruction,0,1089
"```dates_dict.setdefault(key, []).append(date)```",output,1,1089
Group the values from django model `Article` with group by value `pub_date` and annotate by `title`,instruction,0,1090
```Article.objects.values('pub_date').annotate(article_count=Count('title'))```,output,1,1090
clear Tkinter Canvas `canvas`,instruction,0,1091
```canvas.delete('all')```,output,1,1091
"Initialize a pandas series object `s` with columns `['A', 'B', 'A1R', 'B2', 'AABB4']`",instruction,0,1092
"```s = pd.Series(['A', 'B', 'A1R', 'B2', 'AABB4'])```",output,1,1092
None,instruction,0,1093
"```datetime.datetime.strptime('2007-03-04T21:08:12', '%Y-%m-%dT%H:%M:%S')```",output,1,1093
sort list `a` using the first dimension of the element as the key to list `b`,instruction,0,1094
```a.sort(key=lambda x: b.index(x[0]))```,output,1,1094
,instruction,0,1095
```a.sort(key=lambda x_y: b.index(x_y[0]))```,output,1,1095
Save plot `plt` as png file 'filename.png',instruction,0,1096
```plt.savefig('filename.png')```,output,1,1096
Save matplotlib graph to image file `filename.png` at a resolution of `300 dpi`,instruction,0,1097
"```plt.savefig('filename.png', dpi=300)```",output,1,1097
get output from process `p1`,instruction,0,1098
```p1.communicate()[0]```,output,1,1098
,instruction,0,1099
"```output = subprocess.Popen(['mycmd', 'myarg'], stdout=PIPE).communicate()[0]```",output,1,1099
searche in HTML string for elements that have text 'Python',instruction,0,1100
```soup.body.findAll(text='Python')```,output,1,1100
BeautifulSoup find string 'Python Jobs' in HTML body `body`,instruction,0,1101
```soup.body.findAll(text='Python Jobs')```,output,1,1101
Sort items in dictionary `d`  using the first part of the key after splitting the key,instruction,0,1102
"```sorted(list(d.items()), key=lambda name_num: (name_num[0].rsplit(None, 1)[0], name_num[1]))```",output,1,1102
"create a set that is the exclusive or of [1, 2, 3] and [3, 4, 5]",instruction,0,1103
"```set([1, 2, 3]) ^ set([3, 4, 5])```",output,1,1103
Get a list values of a dictionary item `pass_id` from post requests in django,instruction,0,1104
```request.POST.getlist('pass_id')```,output,1,1104
Filter duplicate entries w.r.t. value in 'id' from a list of dictionaries 'L',instruction,0,1105
"```list(dict((x['id'], x) for x in L).values())```",output,1,1105
Get pandas GroupBy object with sum over the rows with same column names within  dataframe `df`,instruction,0,1106
"```df.groupby(df.columns, axis=1).sum()```",output,1,1106
"convert the zip of range `(1, 5)` and range `(7, 11)` into a dictionary",instruction,0,1107
"```dict(zip(list(range(1, 5)), list(range(7, 11))))```",output,1,1107
Get all indexes of boolean numpy array where boolean value `mask` is True,instruction,0,1108
```numpy.where(mask)```,output,1,1108
case insensitive comparison of strings `string1` and `string2`,instruction,0,1109
"```if (string1.lower() == string2.lower()):
    print('The strings are the same (case insensitive)')
else:
    print('The strings are not the same (case insensitive)')```",output,1,1109
case insensitive string comparison between `string1` and `string2`,instruction,0,1110
"```if (string1.lower() == string2.lower()):
    pass```",output,1,1110
case insensitive string comparison between `string1` and `string2`,instruction,0,1111
```(string1.lower() == string2.lower())```,output,1,1111
case insensitive string comparison between `first` and `second`,instruction,0,1112
```(first.lower() == second.lower())```,output,1,1112
case insensitive comparison between strings `first` and `second`,instruction,0,1113
```(first.upper() == second.upper())```,output,1,1113
"Taking the results of a bash command ""awk '{print $10, $11}' test.txt > test2.txt""",instruction,0,1114
"```os.system(""awk '{print $10, $11}' test.txt > test2.txt"")```",output,1,1114
remove multiple values from a list `my_list` at the same time with index starting at `2` and ending just before `6`.,instruction,0,1115
```del my_list[2:6]```,output,1,1115
convert a string `s` to its base-10 representation,instruction,0,1116
"```int(s.encode('hex'), 16)```",output,1,1116
match regex pattern 'TAA(?:[ATGC]{3})+?TAA' on string `seq`,instruction,0,1117
"```re.findall('TAA(?:[ATGC]{3})+?TAA', seq)```",output,1,1117
sort a set `s` by numerical value,instruction,0,1118
"```sorted(s, key=float)```",output,1,1118
convert an int 65 to hex string,instruction,0,1119
```hex(65)```,output,1,1119
append a pandas series `b` to the series `a` and get a continuous index,instruction,0,1120
```a.append(b).reset_index(drop=True)```,output,1,1120
simple way to append a pandas series `a` and `b` with same index,instruction,0,1121
"```pd.concat([a, b], ignore_index=True)```",output,1,1121
Get a list of tuples with multiple iterators using list comprehension,instruction,0,1122
"```[(i, j) for i in range(1, 3) for j in range(1, 5)]```",output,1,1122
reverse sort items in dictionary `mydict` by value,instruction,0,1123
"```sorted(iter(mydict.items()), key=itemgetter(1), reverse=True)```",output,1,1123
select the last business day of the month for each month in 2014 in pandas,instruction,0,1124
"```pd.date_range('1/1/2014', periods=12, freq='BM')```",output,1,1124
disable the certificate check in https requests for url `https://kennethreitz.com`,instruction,0,1125
"```requests.get('https://kennethreitz.com', verify=False)```",output,1,1125
return dataframe `df` with last row dropped,instruction,0,1126
```df.ix[:-1]```,output,1,1126
"check if ""blah"" is in string `somestring`",instruction,0,1127
"```if ('blah' not in somestring):
    pass```",output,1,1127
check if string `needle` is in `haystack`,instruction,0,1128
"```if (needle in haystack):
    pass```",output,1,1128
"check if string ""substring"" is in string",instruction,0,1129
```string.find('substring')```,output,1,1129
"check if string `s` contains ""is""",instruction,0,1130
"```if (s.find('is') == (-1)):
    print(""No 'is' here!"")
else:
    print(""Found 'is' in the string."")```",output,1,1130
extract first and last row of a dataframe `df`,instruction,0,1131
"```pd.concat([df.head(1), df.tail(1)])```",output,1,1131
filter a Django model `MyModel` to have charfield length of max `255`,instruction,0,1132
```MyModel.objects.extra(where=['CHAR_LENGTH(text) > 254'])```,output,1,1132
Filter queryset for all objects in Django model `MyModel` where texts length are greater than `254`,instruction,0,1133
```MyModel.objects.filter(text__regex='^.{254}.*')```,output,1,1133
count the number of rows with missing values in a pandas dataframe `df`,instruction,0,1134
"```sum(df.apply(lambda x: sum(x.isnull().values), axis=1) > 0)```",output,1,1134
,instruction,0,1135
"```sorted(enumerate(a), key=lambda x: x[1])```",output,1,1135
set the font 'Purisa' of size 12 for a canvas' text item `k`,instruction,0,1136
"```canvas.create_text(x, y, font=('Purisa', 12), text=k)```",output,1,1136
create a list containing all values associated with key 'baz' in dictionaries of list `foos` using list comprehension,instruction,0,1137
```[y['baz'] for x in foos for y in x['bar']]```,output,1,1137
read pandas data frame csv `comma.csv` with extra commas in column specifying string delimiter `'`,instruction,0,1138
"```df = pd.read_csv('comma.csv', quotechar=""'"")```",output,1,1138
replace string 'in.' with ' in. ' in dataframe `df` column 'a',instruction,0,1139
"```df['a'] = df['a'].str.replace('in.', ' in. ')```",output,1,1139
Get all indexes of a list `a` where each value is greater than `2`,instruction,0,1140
```[i for i in range(len(a)) if a[i] > 2]```,output,1,1140
check if a local variable `myVar` exists,instruction,0,1141
```('myVar' in locals())```,output,1,1141
check if a global variable `myVar` exists,instruction,0,1142
```('myVar' in globals())```,output,1,1142
check if object `obj` has attribute 'attr_name',instruction,0,1143
"```hasattr(obj, 'attr_name')```",output,1,1143
check if a local variable 'myVar' exists,instruction,0,1144
"```if ('myVar' in locals()):
    pass```",output,1,1144
check if a global variable 'myVar' exists,instruction,0,1145
"```if ('myVar' in globals()):
    pass```",output,1,1145
lambda function that adds two operands,instruction,0,1146
"```lambda x, y: x + y```",output,1,1146
count the number of items in a generator/iterator `it`,instruction,0,1147
```sum(1 for i in it)```,output,1,1147
get tuples of the corresponding elements from lists `lst` and `lst2`,instruction,0,1148
"```[(x, lst2[i]) for i, x in enumerate(lst)]```",output,1,1148
create tuples containing elements that are at the same index of list `lst` and list `lst2`,instruction,0,1149
"```[(i, j) for i, j in zip(lst, lst2)]```",output,1,1149
get tuples from lists `lst` and `lst2` using list comprehension in python 2,instruction,0,1150
"```[(lst[i], lst2[i]) for i in range(len(lst))]```",output,1,1150
convert hex triplet string `rgbstr` to rgb tuple,instruction,0,1151
"```struct.unpack('BBB', rgbstr.decode('hex'))```",output,1,1151
"Check if 3 is not in a list [2, 3, 4]",instruction,0,1152
"```(3 not in [2, 3, 4])```",output,1,1152
"Check if tuple (2, 3) is not in a list [(2, 3), (5, 6), (9, 1)]",instruction,0,1153
"```((2, 3) not in [(2, 3), (5, 6), (9, 1)])```",output,1,1153
"Check if tuple (2, 3) is not in a list [(2, 7), (7, 3), ""hi""]",instruction,0,1154
"```((2, 3) not in [(2, 7), (7, 3), 'hi'])```",output,1,1154
"Check if 3 is not in the list [4,5,6]",instruction,0,1155
"```(3 not in [4, 5, 6])```",output,1,1155
create a list by appending components from list `a` and reversed list `b` interchangeably,instruction,0,1156
"```[value for pair in zip(a, b[::-1]) for value in pair]```",output,1,1156
delete the last column of numpy array `a` and assign resulting array to `b`,instruction,0,1157
"```b = np.delete(a, -1, 1)```",output,1,1157
commit all the changes after executing a query.,instruction,0,1158
```dbb.commit()```,output,1,1158
join two dataframes based on values in selected columns,instruction,0,1159
"```pd.merge(a, b, on=['A', 'B'], how='outer')```",output,1,1159
set text color as `red` and background color as `#A3C1DA` in qpushbutton,instruction,0,1160
```setStyleSheet('QPushButton {background-color: #A3C1DA; color: red;}')```,output,1,1160
find the mean of elements in list `l`,instruction,0,1161
```sum(l) / float(len(l))```,output,1,1161
Find all the items from a dictionary `D` if the key contains the string `Light`,instruction,0,1162
"```[(k, v) for k, v in D.items() if 'Light' in k]```",output,1,1162
Get a md5 hash from string `thecakeisalie`,instruction,0,1163
```k = hashlib.md5('thecakeisalie').hexdigest()```,output,1,1163
,instruction,0,1164
```os.path.basename(os.path.normpath('/folderA/folderB/folderC/folderD/'))```,output,1,1164
sort datetime objects `birthdays` by `month` and `day`,instruction,0,1165
"```birthdays.sort(key=lambda d: (d.month, d.day))```",output,1,1165
extract table data from table `rows` using beautifulsoup,instruction,0,1166
```[[td.findNext(text=True) for td in tr.findAll('td')] for tr in rows]```,output,1,1166
strip the string `.txt` from anywhere in the string `Boat.txt.txt`,instruction,0,1167
"```""""""Boat.txt.txt"""""".replace('.txt', '')```",output,1,1167
get a list of the row names from index of a pandas data frame,instruction,0,1168
```list(df.index)```,output,1,1168
get the row names from index in a pandas data frame,instruction,0,1169
```df.index```,output,1,1169
create a list of all unique characters in string 'aaabcabccd',instruction,0,1170
"```"""""""""""".join(list(OrderedDict.fromkeys('aaabcabccd').keys()))```",output,1,1170
get list of all unique characters in a string 'aaabcabccd',instruction,0,1171
```list(set('aaabcabccd'))```,output,1,1171
,instruction,0,1172
"```"""""""""""".join(set('aaabcabccd'))```",output,1,1172
find rows with non zero values in a subset of columns where `df.dtypes` is not equal to `object` in pandas dataframe,instruction,0,1173
"```df.loc[(df.loc[:, (df.dtypes != object)] != 0).any(1)]```",output,1,1173
,instruction,0,1174
"```br.form.add_file(open(filename), 'text/plain', filename)```",output,1,1174
"check if  dictionary `d` contains all keys in list `['somekey', 'someotherkey', 'somekeyggg']`",instruction,0,1175
"```all(word in d for word in ['somekey', 'someotherkey', 'somekeyggg'])```",output,1,1175
"hide output of subprocess `['espeak', text]`",instruction,0,1176
"```subprocess.check_output(['espeak', text], stderr=subprocess.STDOUT)```",output,1,1176
replace nans by preceding values in pandas dataframe `df`,instruction,0,1177
"```df.fillna(method='ffill', inplace=True)```",output,1,1177
create 4 numbers in range between 1 and 3,instruction,0,1178
"```print(np.linspace(1, 3, num=4, endpoint=False))```",output,1,1178
Create numpy array of `5` numbers starting from `1` with interval of `3`,instruction,0,1179
"```print(np.linspace(1, 3, num=5))```",output,1,1179
create a symlink directory `D:\\testdirLink` for directory `D:\\testdir` with unicode support using ctypes library,instruction,0,1180
"```kdll.CreateSymbolicLinkW('D:\\testdirLink', 'D:\\testdir', 1)```",output,1,1180
get a list `slice` of array slices of the first two rows and columns from array `arr`,instruction,0,1181
"```slice = [arr[i][0:2] for i in range(0, 2)]```",output,1,1181
upload uploaded file from path '/upload' to Google cloud storage 'my_bucket' bucket,instruction,0,1182
"```upload_url = blobstore.create_upload_url('/upload', gs_bucket_name='my_bucket')```",output,1,1182
change directory to the directory of a python script,instruction,0,1183
```os.chdir(os.path.dirname(__file__))```,output,1,1183
call a function with argument list `args`,instruction,0,1184
```func(*args)```,output,1,1184
split column 'AB' in dataframe `df` into two columns by first whitespace ' ',instruction,0,1185
"```df['AB'].str.split(' ', 1, expand=True)```",output,1,1185
"pandas dataframe, how do i split a column 'AB' into two 'A' and 'B' on delimiter ' '",instruction,0,1186
"```df['A'], df['B'] = df['AB'].str.split(' ', 1).str```",output,1,1186
sort list `xs` based on the length of its elements,instruction,0,1187
"```print(sorted(xs, key=len))```",output,1,1187
sort list `xs` in ascending order of length of elements,instruction,0,1188
"```xs.sort(lambda x, y: cmp(len(x), len(y)))```",output,1,1188
sort list of strings `xs` by the length of string,instruction,0,1189
```xs.sort(key=lambda s: len(s))```,output,1,1189
plot point marker '.' on series `ts`,instruction,0,1190
```ts.plot(marker='.')```,output,1,1190
get all combination of n binary values,instruction,0,1191
"```lst = list(itertools.product([0, 1], repeat=n))```",output,1,1191
get all combination of n binary values,instruction,0,1192
"```lst = map(list, itertools.product([0, 1], repeat=n))```",output,1,1192
get all combination of 3 binary values,instruction,0,1193
"```bin = [0, 1]
[(x, y, z) for x in bin for y in bin for z in bin]```",output,1,1193
get all combination of 3 binary values,instruction,0,1194
"```lst = list(itertools.product([0, 1], repeat=3))```",output,1,1194
append string 'str' at the beginning of each value in column 'col' of dataframe `df`,instruction,0,1195
```df['col'] = 'str' + df['col'].astype(str)```,output,1,1195
"get a dict of variable names `['some', 'list', 'of', 'vars']` as a string and their values",instruction,0,1196
"```dict((name, eval(name)) for name in ['some', 'list', 'of', 'vars'])```",output,1,1196
add a colorbar to plot `plt` using image `im` on axes `ax`,instruction,0,1197
"```plt.colorbar(im, ax=ax)```",output,1,1197
convert nested list 'Cards' into a flat list,instruction,0,1198
```[a for c in Cards for b in c for a in b]```,output,1,1198
create a list containing keys of dictionary `d` and sort it alphabetically,instruction,0,1199
"```sorted(d, key=d.get)```",output,1,1199
print the number of occurences of not `none` in a list `lst` in Python 2,instruction,0,1200
```print(len([x for x in lst if x is not None]))```,output,1,1200
lookup dictionary key `key1` in Django template `json`,instruction,0,1201
```{{json.key1}}```,output,1,1201
remove duplicates from list `myset`,instruction,0,1202
```mynewlist = list(myset)```,output,1,1202
"get unique values from the list `['a', 'b', 'c', 'd']`",instruction,0,1203
"```set(['a', 'b', 'c', 'd'])```",output,1,1203
"set size of `figure` to landscape A4 i.e. `11.69, 8.27` inches",instruction,0,1204
"```figure(figsize=(11.69, 8.27))```",output,1,1204
get every thing after last `/`,instruction,0,1205
"```url.rsplit('/', 1)```",output,1,1205
get everything after last slash in a url stored in variable 'url',instruction,0,1206
"```url.rsplit('/', 1)[-1]```",output,1,1206
open file '5_1.txt' in directory `direct`,instruction,0,1207
"```x_file = open(os.path.join(direct, '5_1.txt'), 'r')```",output,1,1207
create a list with the characters of a string `5+6`,instruction,0,1208
```list('5+6')```,output,1,1208
concatenate a list of numpy arrays `input_list` together into a flattened list of values,instruction,0,1209
```np.concatenate(input_list).ravel().tolist()```,output,1,1209
convert dictionary `dict` into a flat list,instruction,0,1210
```print([y for x in list(dict.items()) for y in x])```,output,1,1210
Convert a dictionary `dict` into a list with key and values as list items.,instruction,0,1211
```[y for x in list(dict.items()) for y in x]```,output,1,1211
get a random record from model 'MyModel' using django's orm,instruction,0,1212
```MyModel.objects.order_by('?').first()```,output,1,1212
change current working directory to directory 'chapter3',instruction,0,1213
```os.chdir('chapter3')```,output,1,1213
change current working directory,instruction,0,1214
```os.chdir('C:\\Users\\username\\Desktop\\headfirstpython\\chapter3')```,output,1,1214
change current working directory,instruction,0,1215
```os.chdir('.\\chapter3')```,output,1,1215
create a flat dictionary by summing values associated with similar keys in each dictionary of list `dictlist`,instruction,0,1216
"```dict((key, sum(d[key] for d in dictList)) for key in dictList[0])```",output,1,1216
sort pandas data frame `df` using values from columns `c1` and `c2` in ascending order,instruction,0,1217
"```df.sort(['c1', 'c2'], ascending=[True, True])```",output,1,1217
Converting string lists `s` to float list,instruction,0,1218
```floats = [float(x) for x in s.split()]```,output,1,1218
Converting string lists `s` to float list,instruction,0,1219
"```floats = map(float, s.split())```",output,1,1219
"set labels `[1, 2, 3, 4, 5]` on axis X in plot `plt`",instruction,0,1220
"```plt.xticks([1, 2, 3, 4, 5])```",output,1,1220
read line by line from stdin,instruction,0,1221
"```for line in fileinput.input():
    pass```",output,1,1221
read line by line from stdin,instruction,0,1222
"```for line in sys.stdin:
    pass```",output,1,1222
check if string `one` exists in the values of dictionary `d`,instruction,0,1223
```'one' in list(d.values())```,output,1,1223
Check if value 'one' is among the values of dictionary `d`,instruction,0,1224
```'one' in iter(d.values())```,output,1,1224
call parent class `Instructor` of child class constructor,instruction,0,1225
"```super(Instructor, self).__init__(name, year)```",output,1,1225
create a dictionary using two lists`x` and `y`,instruction,0,1226
"```dict(zip(x, y))```",output,1,1226
sort a list of dictionaries `a` by dictionary values in descending order,instruction,0,1227
"```sorted(a, key=lambda i: list(i.values())[0], reverse=True)```",output,1,1227
sorting a list of dictionary `a` by values in descending order,instruction,0,1228
"```sorted(a, key=dict.values, reverse=True)```",output,1,1228
"Use multiple groupby and agg operations `sum`, `count`, `std` for pandas data frame `df`",instruction,0,1229
"```df.groupby(level=0).agg(['sum', 'count', 'std'])```",output,1,1229
"for a dictionary `a`, set default value for key `somekey` as list and append value `bob`  in that key",instruction,0,1230
"```a.setdefault('somekey', []).append('bob')```",output,1,1230
sum values in list of dictionaries `example_list` with key 'gold',instruction,0,1231
```sum(item['gold'] for item in example_list)```,output,1,1231
get a sum of all values from key `gold` in a list of dictionary `example_list`,instruction,0,1232
```sum([item['gold'] for item in example_list])```,output,1,1232
Get all the values in key `gold` summed from a list of dictionary `myLIst`,instruction,0,1233
```sum(item['gold'] for item in myLIst)```,output,1,1233
writing string 'text to write\n' to file `f`,instruction,0,1234
```f.write('text to write\n')```,output,1,1234
Write a string `My String` to a file `file` including new line character,instruction,0,1235
```file.write('My String\n')```,output,1,1235
find consecutive segments from a column 'A' in a pandas data frame 'df',instruction,0,1236
```df.reset_index().groupby('A')['index'].apply(np.array)```,output,1,1236
get a relative path of file 'my_file' into variable `fn`,instruction,0,1237
"```fn = os.path.join(os.path.dirname(__file__), 'my_file')```",output,1,1237
retrieve an element from a set `s` without removing it,instruction,0,1238
```e = next(iter(s))```,output,1,1238
execute a command in the command prompt to list directory contents of the c drive `c:\\',instruction,0,1239
```os.system('dir c:\\')```,output,1,1239
Make a auto scrolled window to the end of the list in gtk,instruction,0,1240
"```self.treeview.connect('size-allocate', self.treeview_changed)```",output,1,1240
"check if 3 is inside list `[1, 2, 3]`",instruction,0,1241
"```3 in [1, 2, 3]```",output,1,1241
Represent DateTime object '10/05/2012' with format '%d/%m/%Y' into format '%Y-%m-%d',instruction,0,1242
"```datetime.datetime.strptime('10/05/2012', '%d/%m/%Y').strftime('%Y-%m-%d')```",output,1,1242
convert a string literal `s` with values `\\` to raw string literal,instruction,0,1243
"```s = s.replace('\\', '\\\\')```",output,1,1243
get output of script `proc`,instruction,0,1244
```print(proc.communicate()[0])```,output,1,1244
create a pandas data frame from list of nested dictionaries `my_list`,instruction,0,1245
"```pd.concat([pd.DataFrame(l) for l in my_list], axis=1).T```",output,1,1245
delete all columns in  DataFrame `df` that do not hold a non-zero value in its records,instruction,0,1246
"```df.loc[:, ((df != 0).any(axis=0))]```",output,1,1246
sort a multidimensional array `a` by column with index 1,instruction,0,1247
"```sorted(a, key=lambda x: x[1])```",output,1,1247
"split string `s` to list conversion by ','",instruction,0,1248
"```[x.strip() for x in s.split(',')]```",output,1,1248
Get a list of items in the list `container` with attribute equal to `value`,instruction,0,1249
```items = [item for item in container if item.attribute == value]```,output,1,1249
create a file 'filename' with each tuple in the list `mylist` written to a line,instruction,0,1250
"```open('filename', 'w').write('\n'.join('%s %s' % x for x in mylist))```",output,1,1250
Get multiple matched strings using regex pattern `(?:review: )?(http://url.com/(\\d+))\\s?`,instruction,0,1251
"```pattern = re.compile('(?:review: )?(http://url.com/(\\d+))\\s?', re.IGNORECASE)```",output,1,1251
read a text file 'very_Important.txt' into a string variable `str`,instruction,0,1252
"```str = open('very_Important.txt', 'r').read()```",output,1,1252
Return values for column `C` after group by on column `A` and `B` in dataframe `df`,instruction,0,1253
"```df.groupby(['A', 'B'])['C'].unique()```",output,1,1253
read file `fname` line by line into a list `content`,instruction,0,1254
"```with open(fname) as f:
    content = f.readlines()```",output,1,1254
read file 'filename' line by line into a list `lines`,instruction,0,1255
"```with open('filename') as f:
    lines = f.readlines()```",output,1,1255
read file 'filename' line by line into a list `lines`,instruction,0,1256
```lines = [line.rstrip('\n') for line in open('filename')]```,output,1,1256
"read file ""file.txt"" line by line into a list `array`",instruction,0,1257
"```with open('file.txt', 'r') as ins:
    array = []
    for line in ins:
        array.append(line)```",output,1,1257
convert the dataframe column 'col' from string types to datetime types,instruction,0,1258
```df['col'] = pd.to_datetime(df['col'])```,output,1,1258
get a list of the keys in each dictionary in a dictionary of dictionaries `foo`,instruction,0,1259
```[k for d in list(foo.values()) for k in d]```,output,1,1259
"get user input using message 'Enter name here: ' and insert it to the first placeholder in string 'Hello, {0}, how do you do?'",instruction,0,1260
"```print('Hello, {0}, how do you do?'.format(input('Enter name here: ')))```",output,1,1260
create pandas data frame `df` from txt file `filename.txt` with column `Region Name` and separator `;`,instruction,0,1261
"```df = pd.read_csv('filename.txt', sep=';', names=['Region Name'])```",output,1,1261
,instruction,0,1262
```df['a'] = df['a'].apply(lambda x: x + 1)```,output,1,1262
get the platform OS name,instruction,0,1263
```platform.system()```,output,1,1263
sort list `a` in ascending order based on its elements' float values,instruction,0,1264
"```a = sorted(a, key=lambda x: float(x))```",output,1,1264
finding words in string `s` after keyword 'name',instruction,0,1265
"```re.search('name (.*)', s)```",output,1,1265
Find all records from collection `collection` without extracting mongo id `_id`,instruction,0,1266
"```db.collection.find({}, {'_id': False})```",output,1,1266
Get all the second values from a list of lists `A`,instruction,0,1267
```[row[1] for row in A]```,output,1,1267
extract first column from a multi-dimensional array `a`,instruction,0,1268
```[row[0] for row in a]```,output,1,1268
"sort list `['10', '3', '2']` in ascending order based on the integer value of its elements",instruction,0,1269
"```sorted(['10', '3', '2'], key=int)```",output,1,1269
check if file `filename` is descendant of directory '/the/dir/',instruction,0,1270
"```os.path.commonprefix(['/the/dir/', os.path.realpath(filename)]) == '/the/dir/'```",output,1,1270
check if any element of list `substring_list` are in string `string`,instruction,0,1271
```any(substring in string for substring in substring_list)```,output,1,1271
construct pandas dataframe from a list of tuples,instruction,0,1272
"```df = pandas.DataFrame(data, columns=['R_Number', 'C_Number', 'Avg', 'Std'])```",output,1,1272
find and replace 2nd occurrence of word 'cat' by 'Bull' in a sentence 's',instruction,0,1273
"```re.sub('^((?:(?!cat).)*cat(?:(?!cat).)*)cat', '\\1Bull', s)```",output,1,1273
find and replace 2nd occurrence of word 'cat' by 'Bull' in a sentence 's',instruction,0,1274
"```re.sub('^((.*?cat.*?){1})cat', '\\1Bull', s)```",output,1,1274
sort list of strings in list `the_list` by integer suffix,instruction,0,1275
"```sorted(the_list, key=lambda k: int(k.split('_')[1]))```",output,1,1275
"sort list of strings `the_list` by integer suffix before ""_""",instruction,0,1276
"```sorted(the_list, key=lambda x: int(x.split('_')[1]))```",output,1,1276
make a list of lists in which each list `g` are the elements from list `test` which have the same characters up to the first `_` character,instruction,0,1277
"```[list(g) for _, g in itertools.groupby(test, lambda x: x.split('_')[0])]```",output,1,1277
,instruction,0,1278
"```[list(g) for _, g in itertools.groupby(test, lambda x: x.partition('_')[0])]```",output,1,1278
Load the url `http://www.google.com` in selenium webdriver `driver`,instruction,0,1279
```driver.get('http://www.google.com')```,output,1,1279
"using python's datetime module, get the year that utc-11 is currently in",instruction,0,1280
```(datetime.datetime.utcnow() - datetime.timedelta(hours=11)).year```,output,1,1280
"Get the difference between two lists `[1, 2, 2, 2, 3]` and `[1, 2]` that may have duplicate values",instruction,0,1281
"```Counter([1, 2, 2, 2, 3]) - Counter([1, 2])```",output,1,1281
remove tags from a string `mystring`,instruction,0,1282
"```re.sub('<[^>]*>', '', mystring)```",output,1,1282
encode string `data` as `hex`,instruction,0,1283
```data.encode('hex')```,output,1,1283
filter `Users` by field `userprofile` with level greater than or equal to `0`,instruction,0,1284
```User.objects.filter(userprofile__level__gte=0)```,output,1,1284
BeautifulSoup find a tag whose id ends with string 'para',instruction,0,1285
```soup.findAll(id=re.compile('para$'))```,output,1,1285
select `div` tags whose `id`s begin with `value_xxx_c_1_f_8_a_`,instruction,0,1286
"```soup.select('div[id^=""value_xxx_c_1_f_8_a_""]')```",output,1,1286
delete an item `thing` in a list `some_list` if it exists,instruction,0,1287
```cleaned_list = [x for x in some_list if x is not thing]```,output,1,1287
"print ""Please enter something: "" to console, and read user input to `var`",instruction,0,1288
```var = input('Please enter something: ')```,output,1,1288
append 4 to list `foo`,instruction,0,1289
```foo.append(4)```,output,1,1289
"append a list [8, 7] to list `foo`",instruction,0,1290
"```foo.append([8, 7])```",output,1,1290
insert 77 to index 2 of list `x`,instruction,0,1291
"```x.insert(2, 77)```",output,1,1291
remove white space padding around a saved image `test.png` in matplotlib,instruction,0,1292
"```plt.savefig('test.png', bbox_inches='tight')```",output,1,1292
concatenate lists `listone` and `listtwo`,instruction,0,1293
```(listone + listtwo)```,output,1,1293
iterate items in lists `listone` and `listtwo`,instruction,0,1294
"```for item in itertools.chain(listone, listtwo):
    pass```",output,1,1294
create dataframe `males` containing data of dataframe `df` where column `Gender` is equal to 'Male' and column `Year` is equal to 2014,instruction,0,1295
```males = df[(df[Gender] == 'Male') & (df[Year] == 2014)]```,output,1,1295
print backslash,instruction,0,1296
```print('\\')```,output,1,1296
replace '-' in pandas dataframe `df` with `np.nan`,instruction,0,1297
"```df.replace('-', np.nan)```",output,1,1297
delete column 'column_name' from dataframe `df`,instruction,0,1298
"```df = df.drop('column_name', 1)```",output,1,1298
"delete 1st, 2nd and 4th columns from dataframe `df`",instruction,0,1299
"```df.drop(df.columns[[0, 1, 3]], axis=1)```",output,1,1299
delete a column `column_name` without having to reassign from pandas data frame `df`,instruction,0,1300
"```df.drop('column_name', axis=1, inplace=True)```",output,1,1300
disable abbreviation in argparse,instruction,0,1301
```parser = argparse.ArgumentParser(allow_abbrev=False)```,output,1,1301
extract dictionary values by key 'Feature3' from data frame `df`,instruction,0,1302
```feature3 = [d.get('Feature3') for d in df.dic]```,output,1,1302
get data of column 'A' and column 'B' in dataframe `df` where column 'A' is equal to 'foo',instruction,0,1303
"```df.loc[gb.groups['foo'], ('A', 'B')]```",output,1,1303
"print '[1, 2, 3]'",instruction,0,1304
"```print('[%s, %s, %s]' % (1, 2, 3))```",output,1,1304
Display `1 2 3` as a list of string,instruction,0,1305
"```print('[{0}, {1}, {2}]'.format(1, 2, 3))```",output,1,1305
get values from a dictionary `my_dict` whose key contains the string `Date`,instruction,0,1306
"```[v for k, v in list(my_dict.items()) if 'Date' in k]```",output,1,1306
,instruction,0,1307
"```""""""{0.month}/{0.day}/{0.year}"""""".format(my_date)```",output,1,1307
drop a single subcolumn 'a' in column 'col1' from a dataframe `df`,instruction,0,1308
"```df.drop(('col1', 'a'), axis=1)```",output,1,1308
"dropping all columns named 'a' from a multiindex 'df', across all level.",instruction,0,1309
"```df.drop('a', level=1, axis=1)```",output,1,1309
build dictionary with keys of dictionary `_container` as keys and values of returned value of function `_value` with correlating key as parameter,instruction,0,1310
```{_key: _value(_key) for _key in _container}```,output,1,1310
click on the text button 'section-select-all' using selenium python,instruction,0,1311
```browser.find_element_by_class_name('section-select-all').click()```,output,1,1311
"combine two dictionaries `d ` and `d1`, concatenate string values with identical `keys`",instruction,0,1312
"```dict((k, d.get(k, '') + d1.get(k, '')) for k in keys)```",output,1,1312
generate unique equal hash for equal dictionaries `a` and `b`,instruction,0,1313
```hash(pformat(a)) == hash(pformat(b))```,output,1,1313
"convert nested list of lists `[['tom', 'cat'], ['jerry', 'mouse'], ['spark', 'dog']]` into a list of tuples",instruction,0,1314
"```list(map(tuple, [['tom', 'cat'], ['jerry', 'mouse'], ['spark', 'dog']]))```",output,1,1314
"sum the column `positions` along the  other columns `stock`, `same1`, `same2` in a pandas data frame `df`",instruction,0,1315
"```df.groupby(['stock', 'same1', 'same2'], as_index=False)['positions'].sum()```",output,1,1315
,instruction,0,1316
"```df.groupby(['stock', 'same1', 'same2'])['positions'].sum().reset_index()```",output,1,1316
change string `s` to upper case,instruction,0,1317
```s.upper()```,output,1,1317
split a string `s` by ';' and convert to a dictionary,instruction,0,1318
```dict(item.split('=') for item in s.split(';'))```,output,1,1318
"Add header `('Cookie', 'cookiename=cookie value')` to mechanize browser `br`",instruction,0,1319
"```br.addheaders = [('Cookie', 'cookiename=cookie value')]```",output,1,1319
set data in column 'value' of dataframe `df` equal to first element of each list,instruction,0,1320
```df['value'] = df['value'].str[0]```,output,1,1320
get element at index 0 of each list in column 'value' of dataframe `df`,instruction,0,1321
```df['value'] = df['value'].str.get(0)```,output,1,1321
remove square bracket '[]' from pandas dataframe `df` column 'value',instruction,0,1322
```df['value'] = df['value'].str.strip('[]')```,output,1,1322
Get a string with string formatting from dictionary `d`,instruction,0,1323
"```"""""", """""".join(['{}_{}'.format(k, v) for k, v in d.items()])```",output,1,1323
"Sum of sums of each list, in a list of lists named 'lists'.",instruction,0,1324
```sum(sum(x) for x in lists)```,output,1,1324
"Check whether a numpy array `a` contains a given row `[1, 2]`",instruction,0,1325
"```any(np.equal(a, [1, 2]).all(1))```",output,1,1325
check if all elements in list `mylist` are the same,instruction,0,1326
```len(set(mylist)) == 1```,output,1,1326
split a string `s` at line breaks `\r\n`,instruction,0,1327
"```[map(int, x.split('\t')) for x in s.rstrip().split('\r\n')]```",output,1,1327
sort a dictionary `a` by values that are list type,instruction,0,1328
"```t = sorted(list(a.items()), key=lambda x: x[1])```",output,1,1328
Search for string 'blabla' in txt file 'example.txt',instruction,0,1329
"```if ('blabla' in open('example.txt').read()):
    pass```",output,1,1329
Search for string 'blabla' in txt file 'example.txt',instruction,0,1330
"```f = open('example.txt')
s = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
if (s.find('blabla') != (-1)):
    pass```",output,1,1330
Search for string `blabla` in txt file 'example.txt',instruction,0,1331
"```datafile = file('example.txt')
found = False
for line in datafile:
    if (blabla in line):
        return True
return False```",output,1,1331
insert string `string1` after each character of `string2`,instruction,0,1332
"```string2.replace('', string1)[len(string1):-len(string1)]```",output,1,1332
getting every possible combination of two elements in a list,instruction,0,1333
"```list(itertools.combinations([1, 2, 3, 4, 5, 6], 2))```",output,1,1333
get a utf-8 string literal representation of byte string `x`,instruction,0,1334
"```""""""x = {}"""""".format(x.decode('utf8')).encode('utf8')```",output,1,1334
check if `x` is an integer,instruction,0,1335
"```isinstance(x, int)```",output,1,1335
check if `x` is an integer,instruction,0,1336
```(type(x) == int)```,output,1,1336
play the wav file 'sound.wav',instruction,0,1337
"```winsound.PlaySound('sound.wav', winsound.SND_FILENAME)```",output,1,1337
create a list containing the `n` next values of generator `it`,instruction,0,1338
```[next(it) for _ in range(n)]```,output,1,1338
get list of n next values of a generator `it`,instruction,0,1339
"```list(itertools.islice(it, 0, n, 1))```",output,1,1339
compare two lists in python `a` and `b` and return matches,instruction,0,1340
```set(a).intersection(b)```,output,1,1340
,instruction,0,1341
"```[i for i, j in zip(a, b) if i == j]```",output,1,1341
convert list `data` into a string of its elements,instruction,0,1342
"```print(''.join(map(str, data)))```",output,1,1342
match regex pattern '\\$[0-9]+[^\\$]*$' on string '$1 off delicious $5 ham.',instruction,0,1343
"```re.match('\\$[0-9]+[^\\$]*$', '$1 off delicious $5 ham.')```",output,1,1343
import a nested module `c.py` within `b` within `a` with importlib,instruction,0,1344
"```importlib.import_module('.c', 'a.b')```",output,1,1344
import a module 'a.b.c' with importlib.import_module in python 2,instruction,0,1345
```importlib.import_module('a.b.c')```,output,1,1345
Convert array `a` to numpy array,instruction,0,1346
```a = np.array(a)```,output,1,1346
Find all `div` tags whose classes has the value `comment-` in a beautiful soup object `soup`,instruction,0,1347
"```soup.find_all('div', class_=re.compile('comment-'))```",output,1,1347
a sequence of empty lists of length `n`,instruction,0,1348
```[[] for _ in range(n)]```,output,1,1348
create dictionary from list of variables 'foo' and 'bar' already defined,instruction,0,1349
"```dict((k, globals()[k]) for k in ('foo', 'bar'))```",output,1,1349
get two random records from model 'MyModel' in Django,instruction,0,1350
```MyModel.objects.order_by('?')[:2]```,output,1,1350
Print a dictionary `{'user': {'name': 'Markus'}}` with string formatting,instruction,0,1351
"```""""""Hello {user[name]}"""""".format(**{'user': {'name': 'Markus'}})```",output,1,1351
create a dictionary `list_dict` containing each tuple in list `tuple_list` as values and the tuple's first element as the corresponding key,instruction,0,1352
```list_dict = {t[0]: t for t in tuple_list}```,output,1,1352
Generate a random integer between 0 and 9,instruction,0,1353
"```randint(0, 9)```",output,1,1353
Generate a random integer between `a` and `b`,instruction,0,1354
"```random.randint(a, b)```",output,1,1354
Generate random integers between 0 and 9,instruction,0,1355
"```print((random.randint(0, 9)))```",output,1,1355
reverse a string `a` by 2 characters at a time,instruction,0,1356
"```"""""""""""".join(reversed([a[i:i + 2] for i in range(0, len(a), 2)]))```",output,1,1356
transform time series `df` into a pivot table aggregated by column 'Close' using column `df.index.date` as index and values of column `df.index.time` as columns,instruction,0,1357
"```pd.pivot_table(df, index=df.index.date, columns=df.index.time, values='Close')```",output,1,1357
"check if the third element of all the lists in a list ""items"" is equal to zero.",instruction,0,1358
```any(item[2] == 0 for item in items)```,output,1,1358
Find all the lists from a lists of list 'items' if third element in all sub-lists is '0',instruction,0,1359
```[x for x in items if x[2] == 0]```,output,1,1359
sort dictionary of dictionaries `dic` according to the key 'Fisher',instruction,0,1360
"```sorted(list(dic.items()), key=lambda x: x[1]['Fisher'], reverse=True)```",output,1,1360
plot a data logarithmically in y axis,instruction,0,1361
"```plt.yscale('log', nonposy='clip')```",output,1,1361
,instruction,0,1362
"```map(int, re.findall('\\d+', s))```",output,1,1362
list the contents of a directory '/home/username/www/',instruction,0,1363
```os.listdir('/home/username/www/')```,output,1,1363
list all the contents of the directory 'path'.,instruction,0,1364
```os.listdir('path')```,output,1,1364
merge a pandas data frame `distancesDF` and column `dates` in pandas data frame `datesDF` into single,instruction,0,1365
"```pd.concat([distancesDF, datesDF.dates], axis=1)```",output,1,1365
get value of first index of each element in list `a`,instruction,0,1366
```[x[0] for x in a]```,output,1,1366
python how to get every first element in 2 dimensional list `a`,instruction,0,1367
```[i[0] for i in a]```,output,1,1367
remove line breaks from string `textblock` using regex,instruction,0,1368
"```re.sub('(?<=[a-z])\\r?\\n', ' ', textblock)```",output,1,1368
Open gzip-compressed file encoded as utf-8 'file.gz' in text mode,instruction,0,1369
"```gzip.open('file.gz', 'rt', encoding='utf-8')```",output,1,1369
"test if either of strings `a` or `b` are members of the set of strings, `['b', 'a', 'foo', 'bar']`",instruction,0,1370
"```set(['a', 'b']).issubset(['b', 'a', 'foo', 'bar'])```",output,1,1370
"Check if all the values in a list `['a', 'b']` are present in another list `['b', 'a', 'foo', 'bar']`",instruction,0,1371
"```all(x in ['b', 'a', 'foo', 'bar'] for x in ['a', 'b'])```",output,1,1371
"Remove characters ""!@#$"" from a string `line`",instruction,0,1372
"```line.translate(None, '!@#$')```",output,1,1372
"Remove characters ""!@#$"" from a string `line`",instruction,0,1373
"```line = re.sub('[!@#$]', '', line)```",output,1,1373
"Remove string ""1"" from string `string`",instruction,0,1374
"```string.replace('1', '')```",output,1,1374
Remove character `char` from a string `a`,instruction,0,1375
"```a = a.replace(char, '')```",output,1,1375
Remove characters in `b` from a string `a`,instruction,0,1376
"```a = a.replace(char, '')```",output,1,1376
Remove characters in '!@#$' from a string `line`,instruction,0,1377
"```line = line.translate(string.maketrans('', ''), '!@#$')```",output,1,1377
binarize the values in columns of list `order` in a pandas data frame,instruction,0,1378
"```pd.concat([df, pd.get_dummies(df, '', '').astype(int)], axis=1)[order]```",output,1,1378
"store integer 3, 4, 1 and 2 in a list",instruction,0,1379
"```[3, 4, 1, 2]```",output,1,1379
define global variable `something` with value `bob`,instruction,0,1380
```globals()['something'] = 'bob'```,output,1,1380
insert spaces before capital letters in string `text`,instruction,0,1381
"```re.sub('([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))', '\\1 ', text)```",output,1,1381
print unicode string `ex\xe1mple` in uppercase,instruction,0,1382
```print('ex\xe1mple'.upper())```,output,1,1382
get last element of string splitted by '\\' from list of strings `list_dirs`,instruction,0,1383
```[l.split('\\')[-1] for l in list_dirs]```,output,1,1383
combine two sequences into a dictionary,instruction,0,1384
"```dict(zip(keys, values))```",output,1,1384
customize the time format in python logging,instruction,0,1385
```formatter = logging.Formatter('%(asctime)s;%(levelname)s;%(message)s')```,output,1,1385
Replace comma with dot in a string `original_string` using regex,instruction,0,1386
"```new_string = re.sub('""(\\d+),(\\d+)""', '\\1.\\2', original_string)```",output,1,1386
call a function `otherfunc` inside a bash script `test.sh` using subprocess,instruction,0,1387
```subprocess.call('test.sh otherfunc')```,output,1,1387
,instruction,0,1388
"```subprocess.Popen(['bash', '-c', '. foo.sh; go'])```",output,1,1388
remove multiple spaces in a string `foo`,instruction,0,1389
"```"""""" """""".join(foo.split())```",output,1,1389
convert decimal 8 to a list of its binary values,instruction,0,1390
```list('{0:0b}'.format(8))```,output,1,1390
convert decimal integer 8 to a list of its binary values as elements,instruction,0,1391
```[int(x) for x in list('{0:0b}'.format(8))]```,output,1,1391
convert decimal `8` to binary list,instruction,0,1392
```[int(x) for x in bin(8)[2:]]```,output,1,1392
get key-value pairs in dictionary `my_dictionary` for all keys in list `my_list` in the order they appear in `my_list`,instruction,0,1393
"```dict(zip(my_list, map(my_dictionary.get, my_list)))```",output,1,1393
cartesian product of `x` and `y` array points into single array of 2d points,instruction,0,1394
"```numpy.dstack(numpy.meshgrid(x, y)).reshape(-1, 2)```",output,1,1394
selenium wait for driver `driver` 60 seconds before throwing a NoSuchElementExceptions exception,instruction,0,1395
```driver.implicitly_wait(60)```,output,1,1395
selenium webdriver switch to frame 'frameName',instruction,0,1396
```driver.switch_to_frame('frameName')```,output,1,1396
format current date to pattern '{%Y-%m-%d %H:%M:%S}',instruction,0,1397
```time.strftime('{%Y-%m-%d %H:%M:%S}')```,output,1,1397
"sort list `['14:10:01', '03:12:08']`",instruction,0,1398
"```sorted(['14:10:01', '03:12:08'])```",output,1,1398
"find all occurrences of regex pattern '(?:\\w+(?:\\s+\\w+)*,\\s)+(?:\\w+(?:\\s\\w+)*)' in string `x`",instruction,0,1399
"```re.findall('(?:\\w+(?:\\s+\\w+)*,\\s)+(?:\\w+(?:\\s\\w+)*)', x)```",output,1,1399
remove duplicate rows from dataframe `df1` and calculate their frequency,instruction,0,1400
"```df1.groupby(['key', 'year']).size().reset_index()```",output,1,1400
sort dictionary `dictionary` in ascending order by its values,instruction,0,1401
"```sorted(list(dictionary.items()), key=operator.itemgetter(1))```",output,1,1401
Iterate over dictionary `d` in ascending order of values,instruction,0,1402
"```sorted(iter(d.items()), key=lambda x: x[1])```",output,1,1402
"iterate over a python dictionary, ordered by values",instruction,0,1403
"```sorted(list(dictionary.items()), key=lambda x: x[1])```",output,1,1403
split 1d array `a` into 2d array at the last element,instruction,0,1404
"```np.split(a, [-1])```",output,1,1404
convert dataframe `df` into a pivot table using column 'order' as index and values of column 'sample' as columns,instruction,0,1405
"```df.pivot(index='order', columns='sample')```",output,1,1405
select all rows from pandas DataFrame 'df' where the value in column 'A' is greater than 1 or less than -1 in column 'B'.,instruction,0,1406
```df[(df['A'] > 1) | (df['B'] < -1)]```,output,1,1406
"Get the zip output as list from the lists `[1, 2, 3]`, `[4, 5, 6]`, `[7, 8, 9]`",instruction,0,1407
"```[list(a) for a in zip([1, 2, 3], [4, 5, 6], [7, 8, 9])]```",output,1,1407
select rows of dataframe `df` whose value for column `A` is `foo`,instruction,0,1408
```print(df.loc[df['A'] == 'foo'])```,output,1,1408
select rows whose column value in column `column_name` does not equal `some_value` in pandas data frame,instruction,0,1409
```df.loc[df['column_name'] != some_value]```,output,1,1409
select rows from a dataframe `df` whose value for column `column_name` is not in `some_values`,instruction,0,1410
```df.loc[~df['column_name'].isin(some_values)]```,output,1,1410
select all rows whose values in a column `column_name` equals a scalar `some_value` in pandas data frame object `df`,instruction,0,1411
```df.loc[df['column_name'] == some_value]```,output,1,1411
"Select rows whose value of the ""B"" column is ""one"" or ""three"" in the DataFrame `df`",instruction,0,1412
"```print(df.loc[df['B'].isin(['one', 'three'])])```",output,1,1412
repeat every character for 7 times in string 'map',instruction,0,1413
"```"""""""""""".join(map(lambda x: x * 7, 'map'))```",output,1,1413
delete an empty directory,instruction,0,1414
```os.rmdir()```,output,1,1414
recursively delete all contents in directory `path`,instruction,0,1415
"```shutil.rmtree(path, ignore_errors=False, onerror=None)```",output,1,1415
recursively remove folder `name`,instruction,0,1416
```os.removedirs(name)```,output,1,1416
"Add row `['8/19/2014', 'Jun', 'Fly', '98765']` to dataframe `df`",instruction,0,1417
"```df.loc[len(df)] = ['8/19/2014', 'Jun', 'Fly', '98765']```",output,1,1417
list all files in a current directory,instruction,0,1418
```glob.glob('*')```,output,1,1418
List all the files that doesn't contain the name `hello`,instruction,0,1419
```glob.glob('[!hello]*.txt')```,output,1,1419
List all the files that matches the pattern `hello*.txt`,instruction,0,1420
```glob.glob('hello*.txt')```,output,1,1420
evaluate the expression '20<30',instruction,0,1421
```eval('20<30')```,output,1,1421
Copy list `old_list` and name it `new_list`,instruction,0,1422
```new_list = [x[:] for x in old_list]```,output,1,1422
convert scientific notation of variable `a` to decimal,instruction,0,1423
"```""""""{:.50f}"""""".format(float(a[0] / a[1]))```",output,1,1423
convert dataframe `df` to integer-type sparse object,instruction,0,1424
```df.to_sparse(0)```,output,1,1424
display attribute `attr` for each object `obj` in list `my_list_of_objs`,instruction,0,1425
```print([obj.attr for obj in my_list_of_objs])```,output,1,1425
count the number of True values associated with key 'success' in dictionary `d`,instruction,0,1426
```sum(1 if d['success'] else 0 for d in s)```,output,1,1426
get the sum of values associated with the key ‘success’ for a list of dictionaries `s`,instruction,0,1427
```sum(d['success'] for d in s)```,output,1,1427
get complete path of a module named `os`,instruction,0,1428
```imp.find_module('os')[1]```,output,1,1428
get logical xor of `a` and `b`,instruction,0,1429
```(bool(a) != bool(b))```,output,1,1429
get logical xor of `a` and `b`,instruction,0,1430
```((a and (not b)) or ((not a) and b))```,output,1,1430
get logical xor of `a` and `b`,instruction,0,1431
```(bool(a) ^ bool(b))```,output,1,1431
get logical xor of `a` and `b`,instruction,0,1432
"```xor(bool(a), bool(b))```",output,1,1432
get the logical xor of two variables `str1` and `str2`,instruction,0,1433
```return (bool(str1) ^ bool(str2))```,output,1,1433
Sort list `my_list` in alphabetical order based on the values associated with key 'name' of each dictionary in the list,instruction,0,1434
```my_list.sort(key=operator.itemgetter('name'))```,output,1,1434
"split a string `a , b; cdf`  using both commas and semicolons as delimeters",instruction,0,1435
"```re.split('\\s*,\\s*|\\s*;\\s*', 'a , b; cdf')```",output,1,1435
"Split a string `string` by multiple separators `,` and `;`",instruction,0,1436
"```[t.strip() for s in string.split(',') for t in s.split(';')]```",output,1,1436
make a function `f` that calculates the sum of two integer variables `x` and `y`,instruction,0,1437
"```f = lambda x, y: x + y```",output,1,1437
Create list `instancelist` containing 29 objects of type MyClass,instruction,0,1438
```instancelist = [MyClass() for i in range(29)]```,output,1,1438
"Make a dictionary from list `f` which is in the format of four sets of  ""val, key, val""",instruction,0,1439
"```{f[i + 1]: [f[i], f[i + 2]] for i in range(0, len(f), 3)}```",output,1,1439
convert bytes string `s`  to an unsigned integer,instruction,0,1440
"```struct.unpack('>q', s)[0]```",output,1,1440
concatenate a series `students` onto a dataframe `marks` with pandas,instruction,0,1441
"```pd.concat([students, pd.DataFrame(marks)], axis=1)```",output,1,1441
Sort list `alist` in ascending order based on each of its elements' attribute `foo`,instruction,0,1442
```alist.sort(key=lambda x: x.foo)```,output,1,1442
BeautifulSoup select 'div' elements with an id attribute value ending with sub-string '_answer' in HTML parsed string `soup`,instruction,0,1443
```soup.select('div[id$=_answer]')```,output,1,1443
"sympy solve matrix of linear equations `(([1, 1, 1, 1], [1, 1, 2, 3]))` with variables `(x, y, z)`",instruction,0,1444
"```linsolve(Matrix(([1, 1, 1, 1], [1, 1, 2, 3])), (x, y, z))```",output,1,1444
"best way to extract subset of key-value pairs with keys matching 'l', 'm', or 'n' from python dictionary object",instruction,0,1445
"```{k: bigdict[k] for k in list(bigdict.keys()) & {'l', 'm', 'n'}}```",output,1,1445
"extract subset of key-value pairs with keys as `('l', 'm', 'n')` from dictionary object `bigdict`",instruction,0,1446
"```dict((k, bigdict[k]) for k in ('l', 'm', 'n'))```",output,1,1446
"Get items from a dictionary `bigdict` where the keys are present in `('l', 'm', 'n')`",instruction,0,1447
"```{k: bigdict.get(k, None) for k in ('l', 'm', 'n')}```",output,1,1447
"Extract subset of key value pair for keys 'l', 'm', 'n' from `bigdict` in python 3",instruction,0,1448
"```{k: bigdict[k] for k in ('l', 'm', 'n')}```",output,1,1448
Selenium get the entire `driver` page text,instruction,0,1449
```driver.page_source```,output,1,1449
extracting column `1` and `9` from array `data`,instruction,0,1450
"```data[:, ([1, 9])]```",output,1,1450
remove all square brackets from string 'abcd[e]yth[ac]ytwec',instruction,0,1451
"```re.sub('\\[.*?\\]', '', 'abcd[e]yth[ac]ytwec')```",output,1,1451
,instruction,0,1452
```root.geometry('500x500')```,output,1,1452
find all substrings in string `mystring` composed only of letters `a` and `b` where each `a` is directly preceded and succeeded by `b`,instruction,0,1453
"```re.findall('\\b(?:b+a)+b+\\b', mystring)```",output,1,1453
convert list `lst` of tuples of floats to list `str_list` of tuples of strings of floats in scientific notation with eight decimal point precision,instruction,0,1454
```str_list = [tuple('{0:.8e}'.format(flt) for flt in sublist) for sublist in lst]```,output,1,1454
convert list of sublists `lst` of floats to a list of sublists `str_list` of strings of integers in scientific notation with 8 decimal points,instruction,0,1455
```str_list = [['{0:.8e}'.format(flt) for flt in sublist] for sublist in lst]```,output,1,1455
Create a tuple `t` containing first element of each tuple in tuple `s`,instruction,0,1456
```t = tuple(x[0] for x in s)```,output,1,1456
obtain the current day of the week in a 3 letter format from a datetime object,instruction,0,1457
```datetime.datetime.now().strftime('%a')```,output,1,1457
get the ASCII value of a character 'a' as an int,instruction,0,1458
```ord('a')```,output,1,1458
get the ASCII value of a character u'' as an int,instruction,0,1459
```ord('\u3042')```,output,1,1459
get the ASCII value of a character as an int,instruction,0,1460
```ord()```,output,1,1460
decode JSON string `u` to a dictionary,instruction,0,1461
```json.load(u)```,output,1,1461
"Delete mulitple columns `columnheading1`, `columnheading2` in pandas data frame `yourdf`",instruction,0,1462
"```yourdf.drop(['columnheading1', 'columnheading2'], axis=1, inplace=True)```",output,1,1462
get a list of of elements resulting from splitting user input by commas and stripping white space from each resulting string `s`,instruction,0,1463
"```[s.strip() for s in input().split(',')]```",output,1,1463
create a list containing the digits values from binary string `x` as elements,instruction,0,1464
```[int(d) for d in str(bin(x))[2:]]```,output,1,1464
get the max string length in list `i`,instruction,0,1465
```max(len(word) for word in i)```,output,1,1465
get the maximum string length in nested list `i`,instruction,0,1466
"```len(max(i, key=len))```",output,1,1466
execute os command `my_cmd`,instruction,0,1467
```os.system(my_cmd)```,output,1,1467
sort list `mylist` alphabetically,instruction,0,1468
```mylist.sort(key=lambda x: x.lower())```,output,1,1468
sort list `mylist` in alphabetical order,instruction,0,1469
```mylist.sort(key=str.lower)```,output,1,1469
sort a list of strings 'mylist'.,instruction,0,1470
```mylist.sort()```,output,1,1470
sort a list of strings `list`,instruction,0,1471
```list.sort()```,output,1,1471
Set multi index on columns 'Company' and 'date' of data frame `df` in pandas.,instruction,0,1472
"```df.set_index(['Company', 'date'], inplace=True)```",output,1,1472
get the attribute `x` from object `your_obj`,instruction,0,1473
"```getattr(your_obj, x)```",output,1,1473
remove first word in string `s`,instruction,0,1474
"```s.split(' ', 1)[1]```",output,1,1474
save xlsxwriter file in 'app/smth1/smth2/Expenses01.xlsx' path and assign to variable `workbook`,instruction,0,1475
```workbook = xlsxwriter.Workbook('app/smth1/smth2/Expenses01.xlsx')```,output,1,1475
save xlsxwriter file to 'C:/Users/Steven/Documents/demo.xlsx' path,instruction,0,1476
```workbook = xlsxwriter.Workbook('C:/Users/Steven/Documents/demo.xlsx')```,output,1,1476
change legend size to 'x-small' in upper-left location,instruction,0,1477
"```pyplot.legend(loc=2, fontsize='x-small')```",output,1,1477
change legend font size with matplotlib.pyplot to 6,instruction,0,1478
"```plot.legend(loc=2, prop={'size': 6})```",output,1,1478
split list `l` into `n` sized lists,instruction,0,1479
"```[l[i:i + n] for i in range(0, len(l), n)]```",output,1,1479
split a list `l` into evenly sized chunks `n`,instruction,0,1480
"```[l[i:i + n] for i in range(0, len(l), n)]```",output,1,1480
check if character '-' exists in a dataframe `df` cell 'a',instruction,0,1481
```df['a'].str.contains('-')```,output,1,1481
"remove all non -word, -whitespace, or -apostrophe characters from string `doesn't this mean it -technically- works?`",instruction,0,1482
"```re.sub(""[^\\w' ]"", '', ""doesn't this mean it -technically- works?"")```",output,1,1482
find all digits between two characters `\xab` and `\xbb`in a string `text`,instruction,0,1483
"```print(re.findall('\\d+', '\n'.join(re.findall('\xab([\\s\\S]*?)\xbb', text))))```",output,1,1483
plot data of column 'index' versus column 'A' of dataframe `monthly_mean` after resetting its index,instruction,0,1484
"```monthly_mean.reset_index().plot(x='index', y='A')```",output,1,1484
"get the output of a subprocess command `echo ""foo""` in command line",instruction,0,1485
"```subprocess.check_output('echo ""foo""', shell=True)```",output,1,1485
Encode each value to 'UTF8' in the list `EmployeeList`,instruction,0,1486
```[x.encode('UTF8') for x in EmployeeList]```,output,1,1486
combine two columns `foo` and `bar` in a pandas data frame,instruction,0,1487
"```pandas.concat([df['foo'].dropna(), df['bar'].dropna()]).reindex_like(df)```",output,1,1487
generate a list of consecutive integers from 0 to 8,instruction,0,1488
```list(range(9))```,output,1,1488
convert list `myintegers` into a unicode string,instruction,0,1489
"```"""""""""""".join(chr(i) for i in myintegers)```",output,1,1489
inherit from class `Executive`,instruction,0,1490
"```super(Executive, self).__init__(*args)```",output,1,1490
Remove the string value `item` from a list of strings `my_sequence`,instruction,0,1491
```[item for item in my_sequence if item != 'item']```,output,1,1491
randomly select an item from list `foo`,instruction,0,1492
```random.choice(foo)```,output,1,1492
"check if all of the following items in list `['a', 'b']` are in a list `['a', 'b', 'c']`",instruction,0,1493
"```set(['a', 'b']).issubset(['a', 'b', 'c'])```",output,1,1493
"Check if all the items in a list `['a', 'b']` exists in another list `l`",instruction,0,1494
"```set(['a', 'b']).issubset(set(l))```",output,1,1494
set the stdin of the process 'grep f' to be b'one\ntwo\nthree\nfour\nfive\nsix\n',instruction,0,1495
"```p = Popen(['grep', 'f'], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
grep_stdout = p.communicate(input='one\ntwo\nthree\nfour\nfive\nsix\n')[0]```",output,1,1495
set the stdin of the process 'grep f' to be 'one\ntwo\nthree\nfour\nfive\nsix\n',instruction,0,1496
"```p = subprocess.Popen(['grep', 'f'], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
p.stdin.write('one\ntwo\nthree\nfour\nfive\nsix\n')
p.communicate()[0]
p.stdin.close()```",output,1,1496
to convert a list of tuples `list_of_tuples` into list of lists,instruction,0,1497
```[list(t) for t in zip(*list_of_tuples)]```,output,1,1497
group a list `list_of_tuples` of tuples by values,instruction,0,1498
```zip(*list_of_tuples)```,output,1,1498
merge pandas dataframe `x` with columns 'a' and 'b' and dataframe `y` with column 'y',instruction,0,1499
"```pd.merge(y, x, on='k')[['a', 'b', 'y']]```",output,1,1499
"Split string with comma (,) and remove whitespace from a string 'my_string'",instruction,0,1500
"```[item.strip() for item in my_string.split(',')]```",output,1,1500
Get all object attributes of object `obj`,instruction,0,1501
```print((obj.__dict__))```,output,1,1501
Get all object attributes of an object,instruction,0,1502
```dir()```,output,1,1502
Get all object attributes of an object,instruction,0,1503
```dir()```,output,1,1503
pygobject center window `window`,instruction,0,1504
```window.set_position(Gtk.WindowPosition.CENTER)```,output,1,1504
change the size of the sci notation to '30' above the y axis in matplotlib `plt`,instruction,0,1505
"```plt.rc('font', **{'size': '30'})```",output,1,1505
check if datafram `df` has any NaN vlaues,instruction,0,1506
```df.isnull().values.any()```,output,1,1506
unpack the arguments out of list `params` to function `some_func`,instruction,0,1507
```some_func(*params)```,output,1,1507
decode encodeuricomponent in GAE,instruction,0,1508
```urllib.parse.unquote(h.path.encode('utf-8')).decode('utf-8')```,output,1,1508
get proportion of rows in dataframe `trace_df` whose values for column `ratio` are greater than 0,instruction,0,1509
```(trace_df['ratio'] > 0).mean()```,output,1,1509
convert a set of tuples `queryresult` to a string `emaillist`,instruction,0,1510
```emaillist = '\n'.join(item[0] for item in queryresult)```,output,1,1510
convert a set of tuples `queryresult` to a list of strings,instruction,0,1511
```[item[0] for item in queryresult]```,output,1,1511
convert a list of tuples `queryresult` to a string from the first indexes.,instruction,0,1512
```emaillist = '\n'.join([item[0] for item in queryresult])```,output,1,1512
get the widget which has currently the focus in tkinter instance `window2`,instruction,0,1513
"```print(('focus object class:', window2.focus_get().__class__))```",output,1,1513
Initialize a list `a` with `10000` items and each item's value `0`,instruction,0,1514
```a = [0] * 10000```,output,1,1514
Keep only unique words in list of words `words` and join into string,instruction,0,1515
"```print(' '.join(sorted(set(words), key=words.index)))```",output,1,1515
generate 6 random numbers between 1 and 50,instruction,0,1516
"```random.sample(range(1, 50), 6)```",output,1,1516
generate six unique random numbers in the range of 1 to 49.,instruction,0,1517
"```random.sample(range(1, 50), 6)```",output,1,1517
lowercase keys and values in dictionary `{'My Key': 'My Value'}`,instruction,0,1518
"```{k.lower(): v.lower() for k, v in list({'My Key': 'My Value'}.items())}```",output,1,1518
lowercase all keys and values in dictionary `{'My Key': 'My Value'}`,instruction,0,1519
"```dict((k.lower(), v) for k, v in {'My Key': 'My Value'}.items())```",output,1,1519
"Convert each key,value pair in a dictionary `{'My Key': 'My Value'}` to lowercase",instruction,0,1520
"```dict((k.lower(), v.lower()) for k, v in {'My Key': 'My Value'}.items())```",output,1,1520
sorting the lists in list of lists `data`,instruction,0,1521
```[sorted(item) for item in data]```,output,1,1521
SQLite get a list of column names from cursor object `cursor`,instruction,0,1522
"```names = list(map(lambda x: x[0], cursor.description))```",output,1,1522
get the absolute path of a running python script,instruction,0,1523
```os.path.abspath(__file__)```,output,1,1523
sort 2d array `matrix` by row with index 1,instruction,0,1524
"```sorted(matrix, key=itemgetter(1))```",output,1,1524
Get all indexes of a letter `e` from a string `word`,instruction,0,1525
"```[index for index, letter in enumerate(word) if letter == 'e']```",output,1,1525
decode utf-8 code `x` into a raw unicode literal,instruction,0,1526
```print(str(x).decode('raw_unicode_escape'))```,output,1,1526
split string 'abcdefg' into a list of characters,instruction,0,1527
"```re.findall('\\w', 'abcdefg')```",output,1,1527
check whether a file `fname` exists,instruction,0,1528
```os.path.isfile(fname)```,output,1,1528
"check whether file ""/path/to/file"" exists",instruction,0,1529
"```my_file = Path('/path/to/file')
if my_file.is_file():
    pass```",output,1,1529
check whether file `file_path` exists,instruction,0,1530
```os.path.exists(file_path)```,output,1,1530
"check whether a file ""/etc/password.txt"" exists",instruction,0,1531
```print(os.path.isfile('/etc/password.txt'))```,output,1,1531
"check whether a file ""/etc"" exists",instruction,0,1532
```print(os.path.isfile('/etc'))```,output,1,1532
"check whether a path ""/does/not/exist"" exists",instruction,0,1533
```print(os.path.exists('/does/not/exist'))```,output,1,1533
"check whether a file ""/does/not/exist"" exists",instruction,0,1534
```print(os.path.isfile('/does/not/exist'))```,output,1,1534
"check whether a path ""/etc"" exists",instruction,0,1535
```print(os.path.exists('/etc'))```,output,1,1535
"check whether a path ""/etc/password.txt"" exists",instruction,0,1536
```print(os.path.exists('/etc/password.txt'))```,output,1,1536
"split string ""a;bcd,ef g"" on delimiters ';' and ','",instruction,0,1537
"```""""""a;bcd,ef g"""""".replace(';', ' ').replace(',', ' ').split()```",output,1,1537
get a list each value `i` in the implicit tuple `range(3)`,instruction,0,1538
```list(i for i in range(3))```,output,1,1538
add field names as headers in csv constructor `writer`,instruction,0,1539
```writer.writeheader()```,output,1,1539
flatten a tuple `l`,instruction,0,1540
"```[(a, b, c) for a, (b, c) in l]```",output,1,1540
convert 3652458 to string represent a 32bit hex number,instruction,0,1541
"```""""""0x{0:08X}"""""".format(3652458)```",output,1,1541
convert a python dictionary `d` to a list of tuples,instruction,0,1542
"```[(v, k) for k, v in list(d.items())]```",output,1,1542
convert dictionary of pairs `d` to a list of tuples,instruction,0,1543
"```[(v, k) for k, v in d.items()]```",output,1,1543
convert python 2 dictionary `a` to a list of tuples where the value is the first tuple element and the key is the second tuple element,instruction,0,1544
"```[(v, k) for k, v in a.items()]```",output,1,1544
convert a python dictionary 'a' to a list of tuples,instruction,0,1545
"```[(k, v) for k, v in a.items()]```",output,1,1545
"convert a list of hex byte strings `['BB', 'A7', 'F6', '9E']` to a list of hex integers",instruction,0,1546
"```[int(x, 16) for x in ['BB', 'A7', 'F6', '9E']]```",output,1,1546
convert the elements of list `L` from hex byte strings to hex integers,instruction,0,1547
"```[int(x, 16) for x in L]```",output,1,1547
"assign values to two variables, `var1` and `var2` from user input response to `'Enter two numbers here: ` split on whitespace",instruction,0,1548
"```var1, var2 = input('Enter two numbers here: ').split()```",output,1,1548
Filter a json from a key-value pair as `{'fixed_key_1': 'foo2'}` in Django,instruction,0,1549
```Test.objects.filter(actions__contains=[{'fixed_key_1': 'foo2'}])```,output,1,1549
create a list containing a four elements long tuples of permutations of binary values,instruction,0,1550
"```itertools.product(list(range(2)), repeat=4)```",output,1,1550
get yesterday's date as a string in `YYYY-MM-DD` format using timedelta,instruction,0,1551
```(datetime.now() - timedelta(1)).strftime('%Y-%m-%d')```,output,1,1551
"Get the dot product of matrix `[1,0,0,1,0,0]` and matrix `[[0,1],[1,1],[1,0],[1,0],[1,1],[0,1]]`",instruction,0,1552
"```np.dot([1, 0, 0, 1, 0, 0], [[0, 1], [1, 1], [1, 0], [1, 0], [1, 1], [0, 1]])```",output,1,1552
convert date strings in pandas dataframe column`df['date']` to pandas timestamps using the format '%d%b%Y',instruction,0,1553
"```df['date'] = pd.to_datetime(df['date'], format='%d%b%Y')```",output,1,1553
Importing file `file` from folder '/path/to/application/app/folder',instruction,0,1554
"```sys.path.insert(0, '/path/to/application/app/folder')
import file```",output,1,1554
do a `left` merge of dataframes `x` and `y` on the column `state` and sort by `index`,instruction,0,1555
"```x.reset_index().merge(y, how='left', on='state', sort=False).sort('index')```",output,1,1555
Create a default empty json object if no json is available in request parameter `mydata`,instruction,0,1556
"```json.loads(request.POST.get('mydata', '{}'))```",output,1,1556
"get a list of tuples of every three consecutive items in list `[1, 2, 3, 4, 5, 6, 7, 8, 9]`",instruction,0,1557
"```list(zip(*((iter([1, 2, 3, 4, 5, 6, 7, 8, 9]),) * 3)))```",output,1,1557
"slice list `[1, 2, 3, 4, 5, 6, 7]` into lists of two elements each",instruction,0,1558
"```list(grouper(2, [1, 2, 3, 4, 5, 6, 7]))```",output,1,1558
,instruction,0,1559
"```[input[i:i + n] for i in range(0, len(input), n)]```",output,1,1559
Sort list `keys` based on its elements' dot-seperated numbers,instruction,0,1560
"```keys.sort(key=lambda x: map(int, x.split('.')))```",output,1,1560
Sort a list of integers `keys` where each value is in string format,instruction,0,1561
```keys.sort(key=lambda x: [int(y) for y in x.split('.')])```,output,1,1561
convert a 3d array `img` of dimensions 4x2x3 to a 2d array   of dimensions 3x8,instruction,0,1562
"```img.transpose(2, 0, 1).reshape(3, -1)```",output,1,1562
replacing 'ABC' and 'AB' values in column 'BrandName' of dataframe `df` with 'A',instruction,0,1563
"```df['BrandName'].replace(['ABC', 'AB'], 'A')```",output,1,1563
"replace values `['ABC', 'AB']` in a column 'BrandName' of  pandas dataframe `df` with another value 'A'",instruction,0,1564
"```df['BrandName'] = df['BrandName'].replace(['ABC', 'AB'], 'A')```",output,1,1564
Subtract the mean of each row in dataframe `df` from the corresponding row's elements,instruction,0,1565
"```df.sub(df.mean(axis=1), axis=0)```",output,1,1565
remove all non-alphabet chars from string `s`,instruction,0,1566
"```"""""""""""".join([i for i in s if i.isalpha()])```",output,1,1566
split a string `s` into integers,instruction,0,1567
```l = (int(x) for x in s.split())```,output,1,1567
split a string `42 0` by white spaces.,instruction,0,1568
"```""""""42 0"""""".split()```",output,1,1568
,instruction,0,1569
"```map(int, '42 0'.split())```",output,1,1569
get indexes of all true boolean values from a list `bool_list`,instruction,0,1570
"```[i for i, elem in enumerate(bool_list, 1) if elem]```",output,1,1570
group dataframe `data` entries by year value of the date in column 'date',instruction,0,1571
```data.groupby(data['date'].map(lambda x: x.year))```,output,1,1571
Get the indices in array `b` of each element appearing in array `a`,instruction,0,1572
"```np.in1d(b, a).nonzero()[0]```",output,1,1572
display current time in readable format,instruction,0,1573
"```time.strftime('%l:%M%p %z on %b %d, %Y')```",output,1,1573
rotate x-axis text labels of plot `ax` 45 degrees,instruction,0,1574
"```ax.set_xticklabels(ax.xaxis.get_majorticklabels(), rotation=45)```",output,1,1574
"append array of strings `['x', 'x', 'x']` into one string",instruction,0,1575
"```"""""""""""".join(['x', 'x', 'x'])```",output,1,1575
retrieve all items in an numpy array 'x' except the item of the index 1,instruction,0,1576
"```x[(np.arange(x.shape[0]) != 1), :, :]```",output,1,1576
pull a value with key 'name' from a json object `item`,instruction,0,1577
```print(item['name'])```,output,1,1577
read a file from redirected stdin and save to variable `result`,instruction,0,1578
```result = sys.stdin.read()```,output,1,1578
Get all the texts without tags from beautiful soup object `soup`,instruction,0,1579
"```"""""""""""".join(soup.findAll(text=True))```",output,1,1579
extract all rows from dataframe `data` where the value of column 'Value' is True,instruction,0,1580
```data[data['Value'] == True]```,output,1,1580
"removing duplicate characters from a string variable ""foo""",instruction,0,1581
"```"""""""""""".join(set(foo))```",output,1,1581
sort objects in model `Profile` based on Theirs `reputation` attribute,instruction,0,1582
"```sorted(Profile.objects.all(), key=lambda p: p.reputation)```",output,1,1582
flatten a dataframe df to a list,instruction,0,1583
```df.values.flatten()```,output,1,1583
sort list `users` using values associated with key 'id' according to elements in list `order`,instruction,0,1584
```users.sort(key=lambda x: order.index(x['id']))```,output,1,1584
sort a python list of dictionaries `users` by a given list `order` of ids 'id' with the desired order,instruction,0,1585
```users.sort(key=lambda x: order.index(x['id']))```,output,1,1585
request URI '<MY_URI>' and pass authorization token 'TOK:<MY_TOKEN>' to the header,instruction,0,1586
"```r = requests.get('<MY_URI>', headers={'Authorization': 'TOK:<MY_TOKEN>'})```",output,1,1586
"un-escape a backslash-escaped string in `Hello,\\nworld!`",instruction,0,1587
"```print('""Hello,\\nworld!""'.decode('string_escape'))```",output,1,1587
match regex pattern 'a*?bc*?' on string 'aabcc' with DOTALL enabled,instruction,0,1588
"```re.findall('a*?bc*?', 'aabcc', re.DOTALL)```",output,1,1588
get second array column length of array `a`,instruction,0,1589
```a.shape[1]```,output,1,1589
use operations like max/min within a row to a dataframe 'd' in pandas,instruction,0,1590
"```d.apply(lambda row: min([row['A'], row['B']]) - row['C'], axis=1)```",output,1,1590
"count number of occurrences of a substring 'ab' in a string ""abcdabcva""",instruction,0,1591
"```""""""abcdabcva"""""".count('ab')```",output,1,1591
get a list of values with key 'key' from a list of dictionaries `l`,instruction,0,1592
```[d['key'] for d in l if 'key' in d]```,output,1,1592
get a list of values for key 'key' from a list of dictionaries `l`,instruction,0,1593
```[d['key'] for d in l]```,output,1,1593
"get a list of values for key ""key"" from a list of dictionaries in `l`",instruction,0,1594
```[d['key'] for d in l]```,output,1,1594
order a list of lists `l1` by the first value,instruction,0,1595
```l1.sort(key=lambda x: int(x[0]))```,output,1,1595
"order a list of lists `[[1, 'mike'], [1, 'bob']]` by the first value of individual list",instruction,0,1596
"```sorted([[1, 'mike'], [1, 'bob']])```",output,1,1596
replace a string `Abc` in case sensitive way using maketrans,instruction,0,1597
"```""""""Abc"""""".translate(maketrans('abcABC', 'defDEF'))```",output,1,1597
"dictionary `d` to string, custom format",instruction,0,1598
"```""""""<br/>"""""".join([('%s:: %s' % (key, value)) for key, value in list(d.items())])```",output,1,1598
,instruction,0,1599
```self.writer.writerow([str(s).encode('utf-8') for s in row])```,output,1,1599
clear terminal screen on windows,instruction,0,1600
```os.system('cls')```,output,1,1600
clear the terminal screen in Linux,instruction,0,1601
```os.system('clear')```,output,1,1601
execute external commands/script `your_own_script` with csh instead of bash,instruction,0,1602
```os.system('tcsh your_own_script')```,output,1,1602
execute command 'echo $0' in Z shell,instruction,0,1603
"```os.system(""zsh -c 'echo $0'"")```",output,1,1603
update a list `l1` dictionaries with a key `count` and value from list `l2`,instruction,0,1604
"```[dict(d, count=n) for d, n in zip(l1, l2)]```",output,1,1604
create a list with the sum of respective elements of the tuples of list `l`,instruction,0,1605
```[sum(x) for x in zip(*l)]```,output,1,1605
sum each value in a list `l` of tuples,instruction,0,1606
"```map(sum, zip(*l))```",output,1,1606
count the number of non-nan elements in a numpy ndarray matrix `data`,instruction,0,1607
```np.count_nonzero(~np.isnan(data))```,output,1,1607
Convert each list in list `main_list` into a tuple,instruction,0,1608
"```map(list, zip(*main_list))```",output,1,1608
"django get the value of key 'title' from POST request `request` if exists, else return empty string ''",instruction,0,1609
"```request.POST.get('title', '')```",output,1,1609
"check if string `test.mp3` ends with one of the strings from a tuple `('.mp3', '.avi')`",instruction,0,1610
"```""""""test.mp3"""""".endswith(('.mp3', '.avi'))```",output,1,1610
split a string 's' by space while ignoring spaces within square braces and quotes.,instruction,0,1611
"```re.findall('\\[[^\\]]*\\]|""[^""]*""|\\S+', s)```",output,1,1611
get biggest 3 values from each column of the pandas dataframe `data`,instruction,0,1612
"```data.apply(lambda x: sorted(x, 3))```",output,1,1612
permanently set the current directory to the 'C:/Users/Name/Desktop',instruction,0,1613
```os.chdir('C:/Users/Name/Desktop')```,output,1,1613
get all characters between two `$` characters in string `string`,instruction,0,1614
"```re.findall('\\$([^$]*)\\$', string)```",output,1,1614
getting the string between 2 '$' characters in '$sin (x)$ is an function of x',instruction,0,1615
"```re.findall('\\$(.*?)\\$', '$sin (x)$ is an function of x')```",output,1,1615
Format a date object `str_data` into iso fomrat,instruction,0,1616
"```datetime.datetime.strptime(str_date, '%m/%d/%Y').date().isoformat()```",output,1,1616
get element at index 0 of first row and element at index 1 of second row in array `A`,instruction,0,1617
"```A[[0, 1], [0, 1]]```",output,1,1617
"subset numpy array `a` by column and row, returning the values from the first row, first column and the second row, second column and the third row, first column.",instruction,0,1618
"```a[np.arange(3), (0, 1, 0)]```",output,1,1618
Get a list of all keys from dictionary `dictA` where the number of occurrences of value `duck` in that key is more than `1`,instruction,0,1619
"```[k for k, v in dictA.items() if v.count('duck') > 1]```",output,1,1619
"Create sub matrix of a list of lists `[[2, 3, 4], [2, 3, 4], [2, 3, 4]]` (without numpy)",instruction,0,1620
"```[[2, 3, 4], [2, 3, 4], [2, 3, 4]]```",output,1,1620
"get an element at index `[1,1]`in a numpy array `arr`",instruction,0,1621
"```print(arr[1, 1])```",output,1,1621
Set colorbar range from `0` to `15` for pyplot object `quadmesh` in matplotlib,instruction,0,1622
"```quadmesh.set_clim(vmin=0, vmax=15)```",output,1,1622
read csv file 'my_file.csv' into numpy array,instruction,0,1623
"```my_data = genfromtxt('my_file.csv', delimiter=',')```",output,1,1623
read csv file 'myfile.csv' into array,instruction,0,1624
"```df = pd.read_csv('myfile.csv', sep=',', header=None)```",output,1,1624
read csv file 'myfile.csv' into array,instruction,0,1625
"```np.genfromtxt('myfile.csv', delimiter=',')```",output,1,1625
read csv file 'myfile.csv' into array,instruction,0,1626
"```np.genfromtxt('myfile.csv', delimiter=',', dtype=None)```",output,1,1626
read the first line of a string `my_string`,instruction,0,1627
```my_string.splitlines()[0]```,output,1,1627
,instruction,0,1628
"```my_string.split('\n', 1)[0]```",output,1,1628
generate a list from a pandas dataframe `df` with the column name and column values,instruction,0,1629
```df.values.tolist()```,output,1,1629
Replace repeated instances of a character '*' with a single instance in a string 'text',instruction,0,1630
"```re.sub('\\*\\*+', '*', text)```",output,1,1630
"replace repeated instances of ""*"" with a single instance of ""*""",instruction,0,1631
"```re.sub('\\*+', '*', text)```",output,1,1631
multiply values of dictionary `dict` with their respective values in dictionary `dict2`,instruction,0,1632
"```dict((k, v * dict2[k]) for k, v in list(dict1.items()) if k in dict2)```",output,1,1632
Get a random string of length `length`,instruction,0,1633
```return ''.join(random.choice(string.lowercase) for i in range(length))```,output,1,1633
Get total number of values in a nested dictionary `food_colors`,instruction,0,1634
```sum(len(x) for x in list(food_colors.values()))```,output,1,1634
count all elements in a nested dictionary `food_colors`,instruction,0,1635
```sum(len(v) for v in food_colors.values())```,output,1,1635
apply logical operator 'AND' to all elements in list `a_list`,instruction,0,1636
```all(a_list)```,output,1,1636
removing vowel characters 'aeiouAEIOU' from string `text`,instruction,0,1637
"```"""""""""""".join(c for c in text if c not in 'aeiouAEIOU')```",output,1,1637
Divide elements in list `a` from elements at the same index in list `b`,instruction,0,1638
"```[(x / y) for x, y in zip(a, b)]```",output,1,1638
match regex 'abc(de)fg(123)' on string 'abcdefg123 and again abcdefg123',instruction,0,1639
"```re.findall('abc(de)fg(123)', 'abcdefg123 and again abcdefg123')```",output,1,1639
apply function `log2` to the grouped values by 'type' in dataframe `df`,instruction,0,1640
```df.groupby('type').apply(lambda x: np.mean(np.log2(x['v'])))```,output,1,1640
get geys of dictionary `my_dict` that contain any values from list `lst`,instruction,0,1641
"```[key for key, value in list(my_dict.items()) if set(value).intersection(lst)]```",output,1,1641
get list of keys in dictionary `my_dict` whose values contain values from list `lst`,instruction,0,1642
"```[key for item in lst for key, value in list(my_dict.items()) if item in value]```",output,1,1642
Sum elements of tuple `b` to their respective elements of each tuple in list `a`,instruction,0,1643
"```c = [[(i + j) for i, j in zip(e, b)] for e in a]```",output,1,1643
get the common prefix from comparing two absolute paths '/usr/var' and '/usr/var2/log',instruction,0,1644
"```os.path.commonprefix(['/usr/var', '/usr/var2/log'])```",output,1,1644
get relative path of path '/usr/var' regarding path '/usr/var/log/',instruction,0,1645
"```print(os.path.relpath('/usr/var/log/', '/usr/var'))```",output,1,1645
filter dataframe `grouped` where the length of each group `x` is bigger than 1,instruction,0,1646
```grouped.filter(lambda x: len(x) > 1)```,output,1,1646
sort dictionary of lists `myDict` by the third item in each list,instruction,0,1647
"```sorted(list(myDict.items()), key=lambda e: e[1][2])```",output,1,1647
"Format string `hello {name}, how are you {name}, welcome {name}` to be interspersed by `name` three times, specifying the value as `john` only once",instruction,0,1648
"```""""""hello {name}, how are you {name}, welcome {name}"""""".format(name='john')```",output,1,1648
"reorder indexed rows `['Z', 'C', 'A']` based on a list in pandas data frame `df`",instruction,0,1649
"```df.reindex(['Z', 'C', 'A'])```",output,1,1649
check if any values in a list `input_list` is a list,instruction,0,1650
"```any(isinstance(el, list) for el in input_list)```",output,1,1650
get the size of list `items`,instruction,0,1651
```len(items)```,output,1,1651
"get the size of a list `[1,2,3]`",instruction,0,1652
"```len([1, 2, 3])```",output,1,1652
get the size of object `items`,instruction,0,1653
```items.__len__()```,output,1,1653
function to get the size of object,instruction,0,1654
```len()```,output,1,1654
get the size of list `s`,instruction,0,1655
```len(s)```,output,1,1655
sort each row in a pandas dataframe `df` in descending order,instruction,0,1656
"```df.sort(axis=1, ascending=False)```",output,1,1656
,instruction,0,1657
"```df.sort(df.columns, axis=1, ascending=False)```",output,1,1657
get count of rows in each series grouped by column 'col5' and column 'col2' of dataframe `df`,instruction,0,1658
"```df.groupby(['col5', 'col2']).size().groupby(level=1).max()```",output,1,1658
"check if string 'x' is  in list `['x', 'd', 'a', 's', 'd', 's']`",instruction,0,1659
"```'x' in ['x', 'd', 'a', 's', 'd', 's']```",output,1,1659
"Delete an item with key ""key"" from `mydict`",instruction,0,1660
"```mydict.pop('key', None)```",output,1,1660
Delete an item with key `key` from `mydict`,instruction,0,1661
```del mydict[key]```,output,1,1661
Delete an item with key `key` from `mydict`,instruction,0,1662
"```try:
    del mydict[key]
except KeyError:
    pass
try:
    del mydict[key]
except KeyError:
    pass```",output,1,1662
specify multiple positional arguments with argparse,instruction,0,1663
"```parser.add_argument('input', nargs='+')```",output,1,1663
Plot using the color code `#112233` in matplotlib pyplot,instruction,0,1664
"```pyplot.plot(x, y, color='#112233')```",output,1,1664
strip html from strings,instruction,0,1665
"```re.sub('<[^<]+?>', '', text)```",output,1,1665
align values in array `b` to the order of corresponding values in array `a`,instruction,0,1666
"```a[np.in1d(a, b)]```",output,1,1666
"split string ""jvm.args= -Dappdynamics.com=true, -Dsomeotherparam=false,"" on the first occurrence of delimiter '='",instruction,0,1667
"```""""""jvm.args= -Dappdynamics.com=true, -Dsomeotherparam=false,"""""".split('=', 1)```",output,1,1667
print numbers in list `list` with precision of 3 decimal places,instruction,0,1668
"```print('[%s]' % ', '.join('%.3f' % val for val in list))```",output,1,1668
format print output of list of floats `l` to print only up to 3 decimal points,instruction,0,1669
"```print('[' + ', '.join('%5.3f' % v for v in l) + ']')```",output,1,1669
print a list of floating numbers `l` using string formatting,instruction,0,1670
```print([('%5.3f' % val) for val in l])```,output,1,1670
Change the current directory one level up,instruction,0,1671
```os.chdir('..')```,output,1,1671
print a unicode string `text`,instruction,0,1672
```print(text.encode('windows-1252'))```,output,1,1672
convert string representation `s2` of binary string rep of integer to floating point number,instruction,0,1673
"```struct.unpack('d', struct.pack('Q', int(s2, 0)))[0]```",output,1,1673
convert a binary '-0b1110' to a float number,instruction,0,1674
"```float(int('-0b1110', 0))```",output,1,1674
convert a binary `b8` to a float number,instruction,0,1675
"```struct.unpack('d', b8)[0]```",output,1,1675
plot a bar graph from the column 'color' in the DataFrame 'df',instruction,0,1676
```df.colour.value_counts().plot(kind='bar')```,output,1,1676
plot categorical data in series `df` with kind `bar` using pandas and matplotlib,instruction,0,1677
```df.groupby('colour').size().plot(kind='bar')```,output,1,1677
strip and split each line `line` on white spaces,instruction,0,1678
```line.strip().split(' ')```,output,1,1678
apply functions `mean` and `std` to each column in dataframe `df`,instruction,0,1679
"```df.groupby(lambda idx: 0).agg(['mean', 'std'])```",output,1,1679
sort dictionary `tag_weight` in reverse order by values cast to integers,instruction,0,1680
"```sorted(list(tag_weight.items()), key=lambda x: int(x[1]), reverse=True)```",output,1,1680
find the largest integer less than `x`,instruction,0,1681
```int(math.ceil(x)) - 1```,output,1,1681
check if the string `myString` is empty,instruction,0,1682
"```if (not myString):
    pass```",output,1,1682
check if string `some_string` is empty,instruction,0,1683
"```if (not some_string):
    pass```",output,1,1683
check if string `my_string` is empty,instruction,0,1684
"```if (not my_string):
    pass```",output,1,1684
check if string `my_string` is empty,instruction,0,1685
"```if some_string:
    pass```",output,1,1685
iterate over a dictionary `d` in sorted order,instruction,0,1686
```it = iter(sorted(d.items()))```,output,1,1686
iterate over a dictionary `d` in sorted order,instruction,0,1687
"```for (key, value) in sorted(d.items()):
    pass```",output,1,1687
iterate over a dictionary `dict` in sorted order,instruction,0,1688
```return sorted(dict.items())```,output,1,1688
iterate over a dictionary `dict` in sorted order,instruction,0,1689
```return iter(sorted(dict.items()))```,output,1,1689
iterate over a dictionary `foo` in sorted order,instruction,0,1690
"```for (k, v) in sorted(foo.items()):
    pass```",output,1,1690
iterate over a dictionary `foo` sorted by the key,instruction,0,1691
"```for k in sorted(foo.keys()):
    pass```",output,1,1691
assign the index of the last occurence of `x` in list `s` to the variable `last`,instruction,0,1692
```last = len(s) - s[::-1].index(x) - 1```,output,1,1692
concatenating values in `list1` to a string,instruction,0,1693
```str1 = ''.join(list1)```,output,1,1693
"concatenating values in list `L` to a string, separate by space",instruction,0,1694
```' '.join((str(x) for x in L))```,output,1,1694
concatenating values in `list1` to a string,instruction,0,1695
```str1 = ''.join((str(e) for e in list1))```,output,1,1695
concatenating values in list `L` to a string,instruction,0,1696
"```makeitastring = ''.join(map(str, L))```",output,1,1696
remove None value from list `L`,instruction,0,1697
```[x for x in L if x is not None]```,output,1,1697
"select a random element from array `[1, 2, 3]`",instruction,0,1698
"```random.choice([1, 2, 3])```",output,1,1698
creating a 5x6 matrix filled with `None` and save it as `x`,instruction,0,1699
```x = [[None for _ in range(5)] for _ in range(6)]```,output,1,1699
create a new 2D array with 2 random rows from array `A`,instruction,0,1700
"```A[(np.random.choice(A.shape[0], 2, replace=False)), :]```",output,1,1700
create a new 2 dimensional array containing two random rows from array `A`,instruction,0,1701
"```A[(np.random.randint(A.shape[0], size=2)), :]```",output,1,1701
combining rows in pandas by adding their values,instruction,0,1702
```df.groupby(df.index).sum()```,output,1,1702
find all `owl:Class` tags by parsing xml with namespace,instruction,0,1703
```root.findall('{http://www.w3.org/2002/07/owl#}Class')```,output,1,1703
generate a random string of length `x`  containing lower cased ASCII letters,instruction,0,1704
"```"""""""""""".join(random.choice(string.lowercase) for x in range(X))```",output,1,1704
add a path `/path/to/2014_07_13_test` to system path,instruction,0,1705
```sys.path.append('/path/to/2014_07_13_test')```,output,1,1705
round number `x` to nearest integer,instruction,0,1706
```int(round(x))```,output,1,1706
round number `h` to nearest integer,instruction,0,1707
```h = int(round(h))```,output,1,1707
round number 32.268907563 up to 3 decimal points,instruction,0,1708
"```round(32.268907563, 3)```",output,1,1708
round number `value` up to `significantDigit` decimal places,instruction,0,1709
"```round(value, significantDigit)```",output,1,1709
round number 1.0005 up to 3 decimal places,instruction,0,1710
"```round(1.0005, 3)```",output,1,1710
round number 2.0005 up to 3 decimal places,instruction,0,1711
"```round(2.0005, 3)```",output,1,1711
round number 3.0005 up to 3 decimal places,instruction,0,1712
"```round(3.0005, 3)```",output,1,1712
round number 4.0005 up to 3 decimal places,instruction,0,1713
"```round(4.0005, 3)```",output,1,1713
round number 8.005 up to 2 decimal places,instruction,0,1714
"```round(8.005, 2)```",output,1,1714
round number 7.005 up to 2 decimal places,instruction,0,1715
"```round(7.005, 2)```",output,1,1715
round number 6.005 up to 2 decimal places,instruction,0,1716
"```round(6.005, 2)```",output,1,1716
round number 1.005 up to 2 decimal places,instruction,0,1717
"```round(1.005, 2)```",output,1,1717
fill missing value in one column 'Cat1' with the value of another column 'Cat2',instruction,0,1718
```df['Cat1'].fillna(df['Cat2'])```,output,1,1718
convert the argument `date` with string formatting in logging,instruction,0,1719
"```logging.info('date=%s', date)```",output,1,1719
Log message of level 'info' with value of `date` in the message,instruction,0,1720
```logging.info('date={}'.format(date))```,output,1,1720
convert values in dictionary `d` into integers,instruction,0,1721
"```{k: int(v) for k, v in d.items()}```",output,1,1721
sum elements at the same index of each list in list `lists`,instruction,0,1722
"```map(sum, zip(*lists))```",output,1,1722
Convert a string `s` containing hex bytes to a hex string,instruction,0,1723
```s.decode('hex')```,output,1,1723
convert a string `s` containing hex bytes to a hex string,instruction,0,1724
```binascii.a2b_hex(s)```,output,1,1724
send data 'HTTP/1.0 200 OK\r\n\r\n' to socket `connection`,instruction,0,1725
```connection.send('HTTP/1.0 200 established\r\n\r\n')```,output,1,1725
send data 'HTTP/1.0 200 OK\r\n\r\n' to socket `connection`,instruction,0,1726
```connection.send('HTTP/1.0 200 OK\r\n\r\n')```,output,1,1726
set the value of cell `['x']['C']` equal to 10 in dataframe `df`,instruction,0,1727
```df['x']['C'] = 10```,output,1,1727
normalize the dataframe `df` along the rows,instruction,0,1728
```np.sqrt(np.square(df).sum(axis=1))```,output,1,1728
remove identical items from list `my_list` and sort it alphabetically,instruction,0,1729
```sorted(set(my_list))```,output,1,1729
find the index of the element with the maximum value from a list 'a'.,instruction,0,1730
"```max(enumerate(a), key=lambda x: x[1])[0]```",output,1,1730
create a list where each element is a value of the key 'Name' for each dictionary `d` in the list `thisismylist`,instruction,0,1731
```[d['Name'] for d in thisismylist]```,output,1,1731
create a list of tuples with the values of keys 'Name' and 'Age' from each dictionary `d` in the list `thisismylist`,instruction,0,1732
"```[(d['Name'], d['Age']) for d in thisismylist]```",output,1,1732
grab one random item from a database `model` in django/postgresql,instruction,0,1733
```model.objects.all().order_by('?')[0]```,output,1,1733
"run python script 'script2.py' from another python script, passing in 1 as an argument",instruction,0,1734
```os.system('script2.py 1')```,output,1,1734
python regex for hyphenated words in `text`,instruction,0,1735
"```re.findall('\\w+(?:-\\w+)+', text)```",output,1,1735
create variable key/value pairs with argparse,instruction,0,1736
"```parser.add_argument('--conf', nargs=2, action='append')```",output,1,1736
Get `3` unique items from a list,instruction,0,1737
"```random.sample(list(range(1, 16)), 3)```",output,1,1737
sort list `strings` in alphabetical order based on the letter after percent character `%` in each element,instruction,0,1738
"```strings.sort(key=lambda str: re.sub('.*%(.).*', '\\1', str))```",output,1,1738
sort a list of strings `strings` based on regex match,instruction,0,1739
"```strings.sort(key=lambda str: re.sub('.*%', '', str))```",output,1,1739
Create list `listy` containing 3 empty lists,instruction,0,1740
```listy = [[] for i in range(3)]```,output,1,1740
sort numpy float array `A` column by column,instruction,0,1741
"```A = np.array(sorted(A, key=tuple))```",output,1,1741
Get a list from two strings `12345` and `ab` with values as each character concatenated,instruction,0,1742
```[(x + y) for x in '12345' for y in 'ab']```,output,1,1742
"trim string "" Hello """,instruction,0,1743
```' Hello '.strip()```,output,1,1743
trim string `myString `,instruction,0,1744
```myString.strip()```,output,1,1744
"Trimming a string "" Hello """,instruction,0,1745
```' Hello '.strip()```,output,1,1745
"Trimming a string "" Hello""",instruction,0,1746
```' Hello'.strip()```,output,1,1746
"Trimming a string ""Bob has a cat""",instruction,0,1747
```'Bob has a cat'.strip()```,output,1,1747
"Trimming a string ""          Hello        """,instruction,0,1748
```'          Hello        '.strip()```,output,1,1748
Trimming a string `str`,instruction,0,1749
```str.strip()```,output,1,1749
"Trimming ""\n"" from string `myString`",instruction,0,1750
```myString.strip('\n')```,output,1,1750
"left trimming ""\n\r"" from string `myString`",instruction,0,1751
```myString.lstrip('\n\r')```,output,1,1751
"right trimming ""\n\t"" from string `myString`",instruction,0,1752
```myString.rstrip('\n\t')```,output,1,1752
"Trimming a string ""  Hello\n"" by space",instruction,0,1753
```'  Hello\n'.strip(' ')```,output,1,1753
"sort a list of tuples 'unsorted' based on two elements, second and third",instruction,0,1754
"```sorted(unsorted, key=lambda element: (element[1], element[2]))```",output,1,1754
decode string `content` to UTF-8 code,instruction,0,1755
```print(content.decode('utf8'))```,output,1,1755
find the index of the maximum value in the array `arr` where the boolean condition in array `cond` is true,instruction,0,1756
"```np.ma.array(np.tile(arr, 2).reshape(2, 3), mask=~cond).argmax(axis=1)```",output,1,1756
"convert a dataframe `df`'s column `ID` into datetime, after removing the first and last 3 letters",instruction,0,1757
```pd.to_datetime(df.ID.str[1:-3])```,output,1,1757
read CSV file 'my.csv' into a dataframe `df` with datatype of float for column 'my_column' considering character 'n/a' as NaN value,instruction,0,1758
"```df = pd.read_csv('my.csv', dtype={'my_column': np.float64}, na_values=['n/a'])```",output,1,1758
convert nan values to ‘n/a’ while reading rows from a csv `read_csv` with pandas,instruction,0,1759
"```df = pd.read_csv('my.csv', na_values=['n/a'])```",output,1,1759
create a list containing all cartesian products of elements in list `a`,instruction,0,1760
```list(itertools.product(*a))```,output,1,1760
remove uppercased characters in string `s`,instruction,0,1761
"```re.sub('[^A-Z]', '', s)```",output,1,1761
convert string '2011221' into a DateTime object using format '%Y%W%w',instruction,0,1762
"```datetime.strptime('2011221', '%Y%W%w')```",output,1,1762
read file 'myfile' using encoding 'iso-8859-1',instruction,0,1763
"```codecs.open('myfile', 'r', 'iso-8859-1').read()```",output,1,1763
create a list containing elements from list `list` that are predicate to function `f`,instruction,0,1764
```[f(x) for x in list]```,output,1,1764
regex matching 5-digit substrings not enclosed with digits in `s`,instruction,0,1765
"```re.findall('(?<!\\d)\\d{5}(?!\\d)', s)```",output,1,1765
create a list containing elements of list `a` if the sum of the element is greater than 10,instruction,0,1766
```[item for item in a if sum(item) > 10]```,output,1,1766
convert currency string `dollars` to decimal `cents_int`,instruction,0,1767
```cents_int = int(round(float(dollars.strip('$')) * 100))```,output,1,1767
remove letters from string `example_line` if the letter exist in list `bad_chars`,instruction,0,1768
"```"""""""""""".join(dropwhile(lambda x: x in bad_chars, example_line[::-1]))[::-1]```",output,1,1768
Creating an empty list `l`,instruction,0,1769
```l = []```,output,1,1769
Creating an empty list `l`,instruction,0,1770
```l = list()```,output,1,1770
Creating an empty list,instruction,0,1771
```list()```,output,1,1771
Creating an empty list,instruction,0,1772
```[]```,output,1,1772
properly quit a program,instruction,0,1773
```sys.exit(0)```,output,1,1773
add string `-` in `4th` position of a string `s`,instruction,0,1774
```s[:4] + '-' + s[4:]```,output,1,1774
append 3 lists in one list,instruction,0,1775
```[[] for i in range(3)]```,output,1,1775
Initialize a list of empty lists `a` of size 3,instruction,0,1776
```a = [[] for i in range(3)]```,output,1,1776
request URL `url` using http header `{'referer': my_referer}`,instruction,0,1777
"```requests.get(url, headers={'referer': my_referer})```",output,1,1777
"set the y axis range to `0, 1000` in subplot using pylab",instruction,0,1778
"```pylab.ylim([0, 1000])```",output,1,1778
convert a column of list in series `s` to dummies,instruction,0,1779
```pd.get_dummies(s.apply(pd.Series).stack()).sum(level=0)```,output,1,1779
,instruction,0,1780
"```max(abs(x - y) for x, y in zip(values[1:], values[:-1]))```",output,1,1780
convert a hex string `x` to string,instruction,0,1781
"```y = str(int(x, 16))```",output,1,1781
check if string `a` is an integer,instruction,0,1782
```a.isdigit()```,output,1,1782
function to check if a string is a number,instruction,0,1783
```isdigit()```,output,1,1783
check if string `b` is a number,instruction,0,1784
```b.isdigit()```,output,1,1784
pandas read comma-separated CSV file `s` and skip commented lines starting with '#',instruction,0,1785
"```pd.read_csv(StringIO(s), sep=',', comment='#')```",output,1,1785
"pandas: change all the values of a column 'Date' into ""int(str(x)[-4:])""",instruction,0,1786
```df['Date'] = df['Date'].apply(lambda x: int(str(x)[-4:]))```,output,1,1786
sum a list of numbers `list_of_nums`,instruction,0,1787
```sum(list_of_nums)```,output,1,1787
Get an item from a list of dictionary `lst` which has maximum value in the key `score` using lambda function,instruction,0,1788
"```max(lst, key=lambda x: x['score'])```",output,1,1788
BeautifulSoup find all tags with attribute 'name' equal to 'description',instruction,0,1789
```soup.findAll(attrs={'name': 'description'})```,output,1,1789
"remove all spaces from a string converted from dictionary `{'a': 1, 'b': 'as df'}`",instruction,0,1790
"```str({'a': 1, 'b': 'as df'}).replace(': ', ':').replace(', ', ',')```",output,1,1790
convert dictionary `dict` into a string formatted object,instruction,0,1791
"```'{' + ','.join('{0!r}:{1!r}'.format(*x) for x in list(dct.items())) + '}'```",output,1,1791
concatenate items from list `parts` into a string starting from the second element,instruction,0,1792
"```"""""""""""".join(parts[1:])```",output,1,1792
"insert a character ',' into a string in front of '+' character in second part of the string",instruction,0,1793
"```"""""",+"""""".join(c.rsplit('+', 1))```",output,1,1793
delete all rows in a numpy array `a` where any value in a row is zero `0`,instruction,0,1794
"```a[np.all(a != 0, axis=1)]```",output,1,1794
extract only alphabetic characters from a string `your string`,instruction,0,1795
"```"""""" """""".join(re.split('[^a-zA-Z]*', 'your string'))```",output,1,1795
Extract only characters from a string as a list,instruction,0,1796
"```re.split('[^a-zA-Z]*', 'your string')```",output,1,1796
get the union set from list of lists `results_list`,instruction,0,1797
```results_union = set().union(*results_list)```,output,1,1797
get the union of values in list of lists `result_list`,instruction,0,1798
```return list(set(itertools.chain(*result_list)))```,output,1,1798
check if a numpy array `a1` contains any element of another array `a2`,instruction,0,1799
"```np.any(np.in1d(a1, a2))```",output,1,1799
removing control characters from a string `s`,instruction,0,1800
```return ''.join(ch for ch in s if unicodedata.category(ch)[0] != 'C')```,output,1,1800
Compare if each value in list `a` is less than respective index value in list `b`,instruction,0,1801
"```all(i < j for i, j in zip(a, b))```",output,1,1801
python selenium click on button '.button.c_button.s_button',instruction,0,1802
```driver.find_element_by_css_selector('.button.c_button.s_button').click()```,output,1,1802
,instruction,0,1803
```driver.find_element_by_css_selector('.button .c_button .s_button').click()```,output,1,1803
kill a process `make.exe` from python script on windows,instruction,0,1804
```os.system('taskkill /im make.exe')```,output,1,1804
SQLAlchemy select records of columns of table `my_table` in addition to current date column,instruction,0,1805
"```print(select([my_table, func.current_date()]).execute())```",output,1,1805
remove duplicate characters from string 'ffffffbbbbbbbqqq',instruction,0,1806
"```re.sub('([a-z])\\1+', '\\1', 'ffffffbbbbbbbqqq')```",output,1,1806
remove periods inbetween capital letters that aren't immediately preceeded by word character(s) in a string `s` using regular expressions,instruction,0,1807
"```re.sub('(?<!\\w)([A-Z])\\.', '\\1', s)```",output,1,1807
Get a list of strings `split_text` with fixed chunk size `n` from a string `the_list`,instruction,0,1808
"```split_list = [the_list[i:i + n] for i in range(0, len(the_list), n)]```",output,1,1808
"match string 'this is my string' with regex '\\b(this|string)\\b'
then replace it with regex '<markup>\\1</markup>'",instruction,0,1809
"```re.sub('\\b(this|string)\\b', '<markup>\\1</markup>', 'this is my string')```",output,1,1809
output data of the first 7 columns of Pandas dataframe,instruction,0,1810
"```pandas.set_option('display.max_columns', 7)```",output,1,1810
Display maximum output data of columns in dataframe `pandas` that will fit into the screen,instruction,0,1811
"```pandas.set_option('display.max_columns', None)```",output,1,1811
set the value in column 'B' to NaN if the corresponding value in column 'A' is equal to 0 in pandas dataframe `df`,instruction,0,1812
"```df.ix[df.A == 0, 'B'] = np.nan```",output,1,1812
"Selecting Element ""//li/label/input"" followed by text ""polishpottery"" with Selenium WebDriver `driver`",instruction,0,1813
"```driver.find_element_by_xpath(""//li/label/input[contains(..,'polishpottery')]"")```",output,1,1813
"Sort a list of dictionaries `mylist` by keys ""weight"" and ""factor""",instruction,0,1814
"```mylist.sort(key=operator.itemgetter('weight', 'factor'))```",output,1,1814
ordering a list of dictionaries `mylist` by elements 'weight' and 'factor',instruction,0,1815
"```mylist.sort(key=lambda d: (d['weight'], d['factor']))```",output,1,1815
Convert a list of lists `lol` to a dictionary with key as second value of a list and value as list itself,instruction,0,1816
```{x[1]: x for x in lol}```,output,1,1816
sort keys of dictionary 'd' based on their values,instruction,0,1817
"```sorted(d, key=lambda k: d[k][1])```",output,1,1817
round 123 to 100,instruction,0,1818
"```int(round(123, -2))```",output,1,1818
create file 'x' if file 'x' does not exist,instruction,0,1819
"```fd = os.open('x', os.O_WRONLY | os.O_CREAT | os.O_EXCL)```",output,1,1819
get a list of last trailing words from another list  of strings`Original_List`,instruction,0,1820
```new_list = [x.split()[-1] for x in Original_List]```,output,1,1820
Reverse a string 'hello world',instruction,0,1821
```'hello world'[::(-1)]```,output,1,1821
Reverse list `s`,instruction,0,1822
```s[::(-1)]```,output,1,1822
Reverse string 'foo',instruction,0,1823
```''.join(reversed('foo'))```,output,1,1823
Reverse a string `string`,instruction,0,1824
```''.join(reversed(string))```,output,1,1824
"Reverse a string ""foo""",instruction,0,1825
```'foo'[::(-1)]```,output,1,1825
Reverse a string `a_string`,instruction,0,1826
```a_string[::(-1)]```,output,1,1826
Reverse a string `a_string`,instruction,0,1827
"```def reversed_string(a_string):
    return a_string[::(-1)]```",output,1,1827
Reverse a string `s`,instruction,0,1828
```''.join(reversed(s))```,output,1,1828
generate a string of numbers separated by comma which is divisible by `4` with remainder `1` or `2`.,instruction,0,1829
"```"""""","""""".join(str(i) for i in range(100) if i % 4 in (1, 2))```",output,1,1829
"convert list `lst` of key, value pairs into a dictionary",instruction,0,1830
"```dict([(e[0], int(e[1])) for e in lst])```",output,1,1830
sorting a list of tuples `list_of_tuples` where each tuple is reversed,instruction,0,1831
"```sorted(list_of_tuples, key=lambda tup: tup[::-1])```",output,1,1831
sorting a list of tuples `list_of_tuples` by second key,instruction,0,1832
"```sorted(list_of_tuples, key=lambda tup: tup[1])```",output,1,1832
Concatenating two one-dimensional NumPy arrays 'a' and 'b'.,instruction,0,1833
"```numpy.concatenate([a, b])```",output,1,1833
writing items in list `thelist` to file `thefile`,instruction,0,1834
"```for item in thelist:
    thefile.write(('%s\n' % item))```",output,1,1834
writing items in list `thelist` to file `thefile`,instruction,0,1835
"```for item in thelist:
    pass```",output,1,1835
serialize `itemlist` to file `outfile`,instruction,0,1836
"```pickle.dump(itemlist, outfile)```",output,1,1836
writing items in list `itemlist` to file `outfile`,instruction,0,1837
```outfile.write('\n'.join(itemlist))```,output,1,1837
Update a user's name as `Bob Marley` having id `123` in SQLAlchemy,instruction,0,1838
```session.query(User).filter_by(id=123).update({'name': 'Bob Marley'})```,output,1,1838
send cookies `cookie` in a post request to url 'http://wikipedia.org' with the python requests library,instruction,0,1839
"```r = requests.post('http://wikipedia.org', cookies=cookie)```",output,1,1839
insert directory 'libs' at the 0th index of current directory,instruction,0,1840
"```sys.path.insert(0, 'libs')```",output,1,1840
get current date and time,instruction,0,1841
```datetime.datetime.now()```,output,1,1841
get current time,instruction,0,1842
```datetime.datetime.now().time()```,output,1,1842
get current time in pretty format,instruction,0,1843
"```strftime('%Y-%m-%d %H:%M:%S', gmtime())```",output,1,1843
get current time in string format,instruction,0,1844
```str(datetime.now())```,output,1,1844
get current time,instruction,0,1845
```datetime.datetime.time(datetime.datetime.now())```,output,1,1845
convert hex '\xff' to integer,instruction,0,1846
```ord('\xff')```,output,1,1846
identify duplicated rows in columns 'PplNum' and 'RoomNum' with additional column in dataframe `df`,instruction,0,1847
"```df.groupby(['PplNum', 'RoomNum']).cumcount() + 1```",output,1,1847
get current utc time,instruction,0,1848
```datetime.utcnow()```,output,1,1848
move last item of array `a` to the first position,instruction,0,1849
```a[-1:] + a[:-1]```,output,1,1849
"Convert dataframe `df` to a pivot table using column 'year', 'month', and 'item' as indexes",instruction,0,1850
"```df.set_index(['year', 'month', 'item']).unstack(level=-1)```",output,1,1850
run a pivot with a multi-index `year` and `month` in a pandas data frame,instruction,0,1851
"```df.pivot_table(values='value', index=['year', 'month'], columns='item')```",output,1,1851
print a rational number `3/2`,instruction,0,1852
```print('\n\x1b[4m' + '3' + '\x1b[0m' + '\n2')```,output,1,1852
,instruction,0,1853
```li1.sort(key=lambda x: not x.startswith('b.'))```,output,1,1853
iterate backwards from 10 to 0,instruction,0,1854
"```range(10, 0, -1)```",output,1,1854
get value of first child of xml node `name`,instruction,0,1855
```name[0].firstChild.nodeValue```,output,1,1855
start a new thread for `myfunction` with parameters 'MyStringHere' and 1,instruction,0,1856
"```thread.start_new_thread(myfunction, ('MyStringHere', 1))```",output,1,1856
start a new thread for `myfunction` with parameters 'MyStringHere' and 1,instruction,0,1857
"```thread.start_new_thread(myfunction, ('MyStringHere', 1))```",output,1,1857
get index of the first biggest element in list `a`,instruction,0,1858
```a.index(max(a))```,output,1,1858
replace periods `.` that are not followed by periods or spaces with a period and a space `. `,instruction,0,1859
"```re.sub('\\.(?=[^ .])', '. ', para)```",output,1,1859
convert a string `a` of letters embedded in squared brackets into embedded lists,instruction,0,1860
"```[i.split() for i in re.findall('\\[([^\\[\\]]+)\\]', a)]```",output,1,1860
extract dictionary `d` from list `a` where the value associated with the key 'name' of dictionary `d` is equal to 'pluto',instruction,0,1861
```[d for d in a if d['name'] == 'pluto']```,output,1,1861
extract dictionary from list of dictionaries based on a key's value.,instruction,0,1862
```[d for d in a if d['name'] == 'pluto']```,output,1,1862
Retrieve list of values from dictionary 'd',instruction,0,1863
```list(d.values())```,output,1,1863
replace occurrences of two whitespaces or more with one whitespace ' ' in string `s`,instruction,0,1864
"```re.sub(' +', ' ', s)```",output,1,1864
Change the mode of file 'my_script.sh' to permission number 484,instruction,0,1865
"```os.chmod('my_script.sh', 484)```",output,1,1865
write pandas dataframe `df` to the file 'c:\\data\\t.csv' without row names,instruction,0,1866
"```df.to_csv('c:\\data\\t.csv', index=False)```",output,1,1866
remove all words which contains number from a string `words` using regex,instruction,0,1867
"```re.sub('\\w*\\d\\w*', '', words).strip()```",output,1,1867
control the keyboard and mouse with dogtail in linux,instruction,0,1868
"```dogtail.rawinput.click(100, 100)```",output,1,1868
parse date string '2009/05/13 19:19:30 -0400' using format '%Y/%m/%d %H:%M:%S %z',instruction,0,1869
"```datetime.strptime('2009/05/13 19:19:30 -0400', '%Y/%m/%d %H:%M:%S %z')```",output,1,1869
Get the position of a regex match for word `is` in a string `String`,instruction,0,1870
"```re.search('\\bis\\b', String).start()```",output,1,1870
Get the position of a regex match `is` in a string `String`,instruction,0,1871
"```re.search('is', String).start()```",output,1,1871
input an integer tuple from user,instruction,0,1872
"```tuple(map(int, input().split(',')))```",output,1,1872
input a tuple of integers from user,instruction,0,1873
"```tuple(int(x.strip()) for x in input().split(','))```",output,1,1873
replace unicode character '\u2022' in string 'str' with '*',instruction,0,1874
"```str.decode('utf-8').replace('\u2022', '*').encode('utf-8')```",output,1,1874
replace unicode characters ''\u2022' in string 'str' with '*',instruction,0,1875
"```str.decode('utf-8').replace('\u2022', '*')```",output,1,1875
convert ndarray with shape 3x3 to array,instruction,0,1876
"```np.zeros((3, 3)).ravel()```",output,1,1876
get os name,instruction,0,1877
"```import platform
platform.system()```",output,1,1877
get os version,instruction,0,1878
"```import platform
platform.release()```",output,1,1878
get the name of the OS,instruction,0,1879
```print(os.name)```,output,1,1879
,instruction,0,1880
```[x for x in my_list if not x.startswith('#')]```,output,1,1880
"replace fields delimited by braces {} in string ""Day old bread, 50% sale {0}"" with string 'today'",instruction,0,1881
"```""""""Day old bread, 50% sale {0}"""""".format('today')```",output,1,1881
Get a minimum value from a list of tuples `list` with values of type `string` and `float` with nan,instruction,0,1882
"```min(list, key=lambda x: float('inf') if math.isnan(x[1]) else x[1])```",output,1,1882
Find average of a nested list `a`,instruction,0,1883
```a = [(sum(x) / len(x)) for x in zip(*a)]```,output,1,1883
Log info message 'Log message' with attributes `{'app_name': 'myapp'}`,instruction,0,1884
"```logging.info('Log message', extra={'app_name': 'myapp'})```",output,1,1884
replace values of dataframe `df` with True if numeric,instruction,0,1885
"```df.applymap(lambda x: isinstance(x, (int, float)))```",output,1,1885
sort list `l` based on its elements' digits,instruction,0,1886
"```sorted(l, key=lambda x: int(re.search('\\d+', x).group(0)))```",output,1,1886
close the window in tkinter,instruction,0,1887
```self.root.destroy()```,output,1,1887
"get mean of columns `2, 5, 6, 7, 8` for all rows in dataframe `df`",instruction,0,1888
"```df.iloc[:, ([2, 5, 6, 7, 8])].mean(axis=1)```",output,1,1888
filter dataframe `df` by sub-level index '0630' in pandas,instruction,0,1889
```df[df.index.map(lambda x: x[1].endswith('0630'))]```,output,1,1889
flask-sqlalchemy delete row `page`,instruction,0,1890
```db.session.delete(page)```,output,1,1890
Format a string `u'Andr\xc3\xa9'` that has unicode characters,instruction,0,1891
"```"""""""""""".join(chr(ord(c)) for c in 'Andr\xc3\xa9')```",output,1,1891
convert a unicode 'Andr\xc3\xa9' to a string,instruction,0,1892
"```"""""""""""".join(chr(ord(c)) for c in 'Andr\xc3\xa9').decode('utf8')```",output,1,1892
"list all files in directory "".""",instruction,0,1893
"```for (dirname, dirnames, filenames) in os.walk('.'):
    for subdirname in dirnames:
        print(os.path.join(dirname, subdirname))
    for filename in filenames:
        pass```",output,1,1893
list all files in directory `path`,instruction,0,1894
```os.listdir(path)```,output,1,1894
rename file `dir` to `dir` + '!',instruction,0,1895
"```os.rename(dir, dir + '!')```",output,1,1895
Insert a character `-` after every two elements in a string `s`,instruction,0,1896
"```""""""-"""""".join(a + b for a, b in zip(s[::2], s[1::2]))```",output,1,1896
printing numbers rounding up to third decimal place,instruction,0,1897
```print('%.3f' % 3.1415)```,output,1,1897
add variable `var` to key 'f' of first element in JSON data `data`,instruction,0,1898
```data[0]['f'] = var```,output,1,1898
get the path of module `a_module`,instruction,0,1899
```print(a_module.__file__)```,output,1,1899
get the path of the current python module,instruction,0,1900
```print(os.getcwd())```,output,1,1900
get the path of the python module `amodule`,instruction,0,1901
```path = os.path.abspath(amodule.__file__)```,output,1,1901
fill list `myList` with 4 0's,instruction,0,1902
```self.myList.extend([0] * (4 - len(self.myList)))```,output,1,1902
drop duplicate indexes in a pandas data frame `df`,instruction,0,1903
```df[~df.index.duplicated()]```,output,1,1903
unpack elements of list `i` as arguments into function `foo`,instruction,0,1904
```foo(*i)```,output,1,1904
generate list of numbers in specific format using string formatting precision.,instruction,0,1905
```[('%.2d' % i) for i in range(16)]```,output,1,1905
sort dictionary `mydict` in descending order based on the sum of each value in it,instruction,0,1906
"```sorted(iter(mydict.items()), key=lambda tup: sum(tup[1]), reverse=True)[:3]```",output,1,1906
get top `3` items from a dictionary `mydict` with largest sum of values,instruction,0,1907
"```heapq.nlargest(3, iter(mydict.items()), key=lambda tup: sum(tup[1]))```",output,1,1907
"get index of character 'b' in list '['a', 'b']'",instruction,0,1908
"```['a', 'b'].index('b')```",output,1,1908
set font size of axis legend of plot `plt` to 'xx-small',instruction,0,1909
"```plt.setp(legend.get_title(), fontsize='xx-small')```",output,1,1909
,instruction,0,1910
```int('  23  ')```,output,1,1910
extract the 2nd elements from a list of tuples,instruction,0,1911
```[x[1] for x in elements]```,output,1,1911
get the opposite diagonal of a numpy array `array`,instruction,0,1912
```np.diag(np.rot90(array))```,output,1,1912
flatten list of tuples `a`,instruction,0,1913
```list(chain.from_iterable(a))```,output,1,1913
substitute two or more whitespace characters with character '|' in string `line`,instruction,0,1914
"```re.sub('\\s{2,}', '|', line.strip())```",output,1,1914
print float `a` with two decimal points,instruction,0,1915
```print(('%.2f' % a))```,output,1,1915
print float `a` with two decimal points,instruction,0,1916
```print(('{0:.2f}'.format(a)))```,output,1,1916
print float `a` with two decimal points,instruction,0,1917
"```print(('{0:.2f}'.format(round(a, 2))))```",output,1,1917
print float `a` with two decimal points,instruction,0,1918
"```print(('%.2f' % round(a, 2)))```",output,1,1918
limit float 13.9499999 to two decimal points,instruction,0,1919
```('%.2f' % 13.9499999)```,output,1,1919
limit float 3.14159 to two decimal points,instruction,0,1920
```('%.2f' % 3.14159)```,output,1,1920
limit float 13.949999999999999 to two decimal points,instruction,0,1921
```float('{0:.2f}'.format(13.95))```,output,1,1921
limit float 13.949999999999999 to two decimal points,instruction,0,1922
```'{0:.2f}'.format(13.95)```,output,1,1922
load a tsv file `c:/~/trainSetRel3.txt` into a pandas data frame,instruction,0,1923
"```DataFrame.from_csv('c:/~/trainSetRel3.txt', sep='\t')```",output,1,1923
set UTC offset by 9 hrs ahead for date '2013/09/11 00:17',instruction,0,1924
```dateutil.parser.parse('2013/09/11 00:17 +0900')```,output,1,1924
"pass a list of parameters `((1, 2, 3),) to sql queue 'SELECT * FROM table WHERE column IN %s;'",instruction,0,1925
"```cur.mogrify('SELECT * FROM table WHERE column IN %s;', ((1, 2, 3),))```",output,1,1925
"sum all elements of two-dimensions list `[[1, 2, 3, 4], [2, 4, 5, 6]]]`",instruction,0,1926
"```sum([sum(x) for x in [[1, 2, 3, 4], [2, 4, 5, 6]]])```",output,1,1926
Retrieve an arbitrary value from dictionary `dict`,instruction,0,1927
```next(iter(dict.values()))```,output,1,1927
access an arbitrary value from dictionary `dict`,instruction,0,1928
```next(iter(list(dict.values())))```,output,1,1928
group dataframe `df` by columns 'Month' and 'Fruit',instruction,0,1929
"```df.groupby(['Month', 'Fruit']).sum().unstack(level=0)```",output,1,1929
sort list `mylist` of tuples by arbitrary key from list `order`,instruction,0,1930
"```sorted(mylist, key=lambda x: order.index(x[1]))```",output,1,1930
sort a list of dictionary `persons` according to the key `['passport']['birth_info']['date']`,instruction,0,1931
"```sorted(persons, key=lambda x: x['passport']['birth_info']['date'])```",output,1,1931
remove the fragment identifier `#something` from a url `http://www.address.com/something#something`,instruction,0,1932
```urlparse.urldefrag('http://www.address.com/something#something')```,output,1,1932
download to a directory '/path/to/dir/filename.ext' from source 'http://example.com/file.ext',instruction,0,1933
"```urllib.request.urlretrieve('http://example.com/file.ext', '/path/to/dir/filename.ext')```",output,1,1933
remove all duplicates from a list of sets `L`,instruction,0,1934
```list(set(frozenset(item) for item in L))```,output,1,1934
remove duplicates from a list of sets 'L',instruction,0,1935
```[set(item) for item in set(frozenset(item) for item in L)]```,output,1,1935
terminate process `p`,instruction,0,1936
```p.terminate()```,output,1,1936
delete all values in a list `mylist`,instruction,0,1937
```del mylist[:]```,output,1,1937
throw an error window in python in windows,instruction,0,1938
"```ctypes.windll.user32.MessageBoxW(0, 'Error', 'Error', 0)```",output,1,1938
remove empty strings from list `str_list`,instruction,0,1939
```str_list = list([_f for _f in str_list if _f])```,output,1,1939
remove newlines and whitespace from string `yourstring`,instruction,0,1940
"```re.sub('[\\ \\n]{2,}', '', yourstring)```",output,1,1940
remove the last dot and all text beyond it in string `s`,instruction,0,1941
"```re.sub('\\.[^.]+$', '', s)```",output,1,1941
remove elements from an array `A` that are in array `B`,instruction,0,1942
"```A[np.all(np.any(A - B[:, (None)], axis=2), axis=0)]```",output,1,1942
Write column 'sum' of DataFrame `a` to csv file 'test.csv',instruction,0,1943
"```a.to_csv('test.csv', cols=['sum'])```",output,1,1943
"call a Python script ""test2.py""",instruction,0,1944
"```exec(compile(open('test2.py').read(), 'test2.py', 'exec'))```",output,1,1944
"call a Python script ""test1.py""",instruction,0,1945
"```subprocess.call('test1.py', shell=True)```",output,1,1945
sort a zipped list `zipped` using lambda function,instruction,0,1946
"```sorted(zipped, key=lambda x: x[1])```",output,1,1946
,instruction,0,1947
```zipped.sort(key=lambda t: t[1])```,output,1,1947
sort a dictionary `y` by value then by key,instruction,0,1948
"```sorted(list(y.items()), key=lambda x: (x[1], x[0]), reverse=True)```",output,1,1948
using beautifulsoup to select div blocks within html `soup`,instruction,0,1949
"```soup.find_all('div', class_='crBlock ')```",output,1,1949
remove elements from list `centroids` the indexes of which are in array `index`,instruction,0,1950
"```[element for i, element in enumerate(centroids) if i not in index]```",output,1,1950
list duplicated elements in two lists `listA` and `listB`,instruction,0,1951
```list(set(listA) & set(listB))```,output,1,1951
"download ""http://randomsite.com/file.gz"" from http and save as ""file.gz""",instruction,0,1952
"```testfile = urllib.request.URLopener()
testfile.retrieve('http://randomsite.com/file.gz', 'file.gz')```",output,1,1952
"download file from http url ""http://randomsite.com/file.gz"" and save as ""file.gz""",instruction,0,1953
"```urllib.request.urlretrieve('http://randomsite.com/file.gz', 'file.gz')```",output,1,1953
download file from http url `file_url`,instruction,0,1954
```file_name = wget.download(file_url)```,output,1,1954
"set an array of unicode characters `[u'\xe9', u'\xe3', u'\xe2']` as labels in Matplotlib `ax`",instruction,0,1955
"```ax.set_yticklabels(['\xe9', '\xe3', '\xe2'])```",output,1,1955
get a list of all integer points in a `dim` dimensional hypercube with coordinates from `-x` to `y` for all dimensions,instruction,0,1956
"```list(itertools.product(list(range(-x, y)), repeat=dim))```",output,1,1956
convert unicode string `s` into string literals,instruction,0,1957
```print(s.encode('unicode_escape'))```,output,1,1957
how to format a list of arguments `my_args` into a string,instruction,0,1958
"```'Hello %s' % ', '.join(my_args)```",output,1,1958
search and split string 'aaa bbb ccc ddd eee fff' by delimiter '(ddd)',instruction,0,1959
"```re.split('(ddd)', 'aaa bbb ccc ddd eee fff', 1)```",output,1,1959
regex search and split string 'aaa bbb ccc ddd eee fff' by delimiter '(d(d)d)',instruction,0,1960
"```re.split('(d(d)d)', 'aaa bbb ccc ddd eee fff', 1)```",output,1,1960
convert a list of dictionaries `d` to pandas data frame,instruction,0,1961
```pd.DataFrame(d)```,output,1,1961
"split string ""This is a string"" into words that do not contain whitespaces",instruction,0,1962
"```""""""This is a string"""""".split()```",output,1,1962
"split string ""This     is a     string"" into words that does not contain whitespaces",instruction,0,1963
"```""""""This     is a     string"""""".split()```",output,1,1963
,instruction,0,1964
"```my_series.apply(your_function, args=(2, 3, 4), extra_kw=1)```",output,1,1964
remove all duplicate items from a list `lseperatedOrblist`,instruction,0,1965
```woduplicates = list(set(lseperatedOrblist))```,output,1,1965
sum of product of combinations in a list `l`,instruction,0,1966
"```sum([(i * j) for i, j in list(itertools.combinations(l, 2))])```",output,1,1966
regular expression for validating string 'user' containing a sequence of characters ending with '-' followed by any number of digits.,instruction,0,1967
```re.compile('{}-\\d*'.format(user))```,output,1,1967
convert all of the items in a list `lst` to float,instruction,0,1968
```[float(i) for i in lst]```,output,1,1968
"multiply all items in a list `[1, 2, 3, 4, 5, 6]` together",instruction,0,1969
"```from functools import reduce
reduce(lambda x, y: x * y, [1, 2, 3, 4, 5, 6])```",output,1,1969
write a tuple of tuples `A` to a csv file using python,instruction,0,1970
```writer.writerow(A)```,output,1,1970
Write all tuple of tuples `A` at once into csv file,instruction,0,1971
```writer.writerows(A)```,output,1,1971
"python, format string ""{} %s {}"" to have 'foo' and 'bar' in the first and second positions",instruction,0,1972
"```""""""{} %s {}"""""".format('foo', 'bar')```",output,1,1972
Truncate `\r\n` from each string in a list of string `example`,instruction,0,1973
"```example = [x.replace('\r\n', '') for x in example]```",output,1,1973
split elements of a list `l` by '\t',instruction,0,1974
```[i.partition('\t')[-1] for i in l if '\t' in i]```,output,1,1974
search for regex pattern 'Test(.*)print' in string `testStr` including new line character '\n',instruction,0,1975
"```re.search('Test(.*)print', testStr, re.DOTALL)```",output,1,1975
find button that is in li class `next` and assign it to variable `next`,instruction,0,1976
```next = driver.find_element_by_css_selector('li.next>a')```,output,1,1976
get the  size of file 'C:\\Python27\\Lib\\genericpath.py',instruction,0,1977
```os.stat('C:\\Python27\\Lib\\genericpath.py').st_size```,output,1,1977
return a string from a regex match with pattern '<img.*?>' in string 'line',instruction,0,1978
"```imtag = re.match('<img.*?>', line).group(0)```",output,1,1978
"Rename a folder `Joe Blow` to `Blow, Joe`",instruction,0,1979
"```os.rename('Joe Blow', 'Blow, Joe')```",output,1,1979
find overlapping matches from a string `hello` using regex,instruction,0,1980
"```re.findall('(?=(\\w\\w))', 'hello')```",output,1,1980
convert 173 to binary string,instruction,0,1981
```bin(173)```,output,1,1981
convert binary string '01010101111' to integer,instruction,0,1982
"```int('01010101111', 2)```",output,1,1982
convert binary string '010101' to integer,instruction,0,1983
"```int('010101', 2)```",output,1,1983
convert binary string '0b0010101010' to integer,instruction,0,1984
"```int('0b0010101010', 2)```",output,1,1984
convert 21 to binary string,instruction,0,1985
```bin(21)```,output,1,1985
convert binary string '11111111' to integer,instruction,0,1986
"```int('11111111', 2)```",output,1,1986
delete all digits in string `s` that are not directly attached to a word character,instruction,0,1987
"```re.sub('$\\d+\\W+|\\b\\d+\\b|\\W+\\d+$', '', s)```",output,1,1987
delete digits at the end of string `s`,instruction,0,1988
"```re.sub('\\b\\d+\\b', '', s)```",output,1,1988
Delete self-contained digits from string `s`,instruction,0,1989
"```s = re.sub('^\\d+\\s|\\s\\d+\\s|\\s\\d+$', ' ', s)```",output,1,1989
truncate string `s` up to character ':',instruction,0,1990
"```s.split(':', 1)[1]```",output,1,1990
"print a string `s` by splitting with comma `,`",instruction,0,1991
"```print(s.split(','))```",output,1,1991
"Create list  by splitting string `mystring` using "","" as delimiter",instruction,0,1992
"```mystring.split(',')```",output,1,1992
remove parentheses only around single words in a string `s` using regex,instruction,0,1993
"```re.sub('\\((\\w+)\\)', '\\1', s)```",output,1,1993
webbrowser open url `url`,instruction,0,1994
```webbrowser.open_new(url)```,output,1,1994
webbrowser open url 'http://example.com',instruction,0,1995
```webbrowser.open('http://example.com')```,output,1,1995
change the background colour of the button `pushbutton` to red,instruction,0,1996
```self.pushButton.setStyleSheet('background-color: red')```,output,1,1996
apply a list of functions named 'functions' over a list of values named 'values',instruction,0,1997
"```[x(y) for x, y in zip(functions, values)]```",output,1,1997
modify the width of a text control as `300` keeping default height in wxpython,instruction,0,1998
"```wx.TextCtrl(self, -1, size=(300, -1))```",output,1,1998
display a grayscale image from array of pixels `imageArray`,instruction,0,1999
"```imshow(imageArray, cmap='Greys_r')```",output,1,1999
replace all the nan values with 0 in a pandas dataframe `df`,instruction,0,2000
```df.fillna(0)```,output,1,2000
export a table dataframe `df` in pyspark to csv 'mycsv.csv',instruction,0,2001
```df.toPandas().to_csv('mycsv.csv')```,output,1,2001
Write DataFrame `df` to csv file 'mycsv.csv',instruction,0,2002
```df.write.csv('mycsv.csv')```,output,1,2002
get the sum of each second value from a list of tuple `structure`,instruction,0,2003
```sum(x[1] for x in structure)```,output,1,2003
sum the 3 largest integers in groupby by 'STNAME' and 'COUNTY_POP',instruction,0,2004
```df.groupby('STNAME')['COUNTY_POP'].agg(lambda x: x.nlargest(3).sum())```,output,1,2004
Parse string '21/11/06 16:30' according to format '%d/%m/%y %H:%M',instruction,0,2005
"```datetime.strptime('21/11/06 16:30', '%d/%m/%y %H:%M')```",output,1,2005
get current script directory,instruction,0,2006
```os.path.dirname(os.path.abspath(__file__))```,output,1,2006
double each character in string `text.read()`,instruction,0,2007
"```re.sub('(.)', '\\1\\1', text.read(), 0, re.S)```",output,1,2007
"concatenate strings in tuple `('a', 'b', 'c', 'd', 'g', 'x', 'r', 'e')` into a single string",instruction,0,2008
"```"""""""""""".join(('a', 'b', 'c', 'd', 'g', 'x', 'r', 'e'))```",output,1,2008
get full path of current directory,instruction,0,2009
```os.path.dirname(os.path.abspath(__file__))```,output,1,2009
"variable number of digits `digits` in variable `value` in format string ""{0:.{1}%}""",instruction,0,2010
"```""""""{0:.{1}%}"""""".format(value, digits)```",output,1,2010
get current requested url,instruction,0,2011
```self.request.url```,output,1,2011
get a random item from list `choices`,instruction,0,2012
```random_choice = random.choice(choices)```,output,1,2012
sum the length of all strings in a list `strings`,instruction,0,2013
```length = sum(len(s) for s in strings)```,output,1,2013
sort a list `s` by first and second attributes,instruction,0,2014
"```s = sorted(s, key=lambda x: (x[1], x[2]))```",output,1,2014
sort a list of lists `s` by second and third element in each list.,instruction,0,2015
"```s.sort(key=operator.itemgetter(1, 2))```",output,1,2015
Mysql commit current transaction,instruction,0,2016
```con.commit()```,output,1,2016
filtering out strings that contain 'ab' from a list of strings `lst`,instruction,0,2017
```[k for k in lst if 'ab' in k]```,output,1,2017
find the first letter of each element in string `input`,instruction,0,2018
```output = ''.join(item[0].upper() for item in input.split())```,output,1,2018
get name of primary field `name` of django model `CustomPK`,instruction,0,2019
```CustomPK._meta.pk.name```,output,1,2019
count the number of words in a string `s`,instruction,0,2020
```len(s.split())```,output,1,2020
multiply array `a` and array `b`respective elements then sum each row of the new array,instruction,0,2021
"```np.einsum('ji,i->j', a, b)```",output,1,2021
check python version,instruction,0,2022
```sys.version```,output,1,2022
check python version,instruction,0,2023
```sys.version_info```,output,1,2023
format number 1000000000.0 using latex notation,instruction,0,2024
```print('\\num{{{0:.2g}}}'.format(1000000000.0))```,output,1,2024
Initialize a list of empty lists `x` of size 3,instruction,0,2025
```x = [[] for i in range(3)]```,output,1,2025
apply jinja2 filters `forceescape` and `linebreaks` on variable `my_variable`,instruction,0,2026
```{{my_variable | forceescape | linebreaks}}```,output,1,2026
"zip a list of tuples `[(1, 4), (2, 5), (3, 6)]` into a list of tuples according to original tuple index",instruction,0,2027
"```zip(*[(1, 4), (2, 5), (3, 6)])```",output,1,2027
split a list of tuples `data` into sub-lists of the same tuple field using itertools,instruction,0,2028
"```[list(group) for key, group in itertools.groupby(data, operator.itemgetter(1))]```",output,1,2028
Convert a string into a list,instruction,0,2029
```list('hello')```,output,1,2029
create new column `A_perc` in dataframe `df` with row values equal to the value in column `A` divided by the value in column `sum`,instruction,0,2030
```df['A_perc'] = df['A'] / df['sum']```,output,1,2030
getting a list of all subdirectories in the directory `directory`,instruction,0,2031
```os.walk(directory)```,output,1,2031
get a list of all subdirectories in the directory `directory`,instruction,0,2032
```[x[0] for x in os.walk(directory)]```,output,1,2032
update all values associated with key `i` to string 'updated' if value `j` is not equal to 'None' in dictionary `d`,instruction,0,2033
"```{i: 'updated' for i, j in list(d.items()) if j != 'None'}```",output,1,2033
Filter a dictionary `d` to remove keys with value None and replace other values with 'updated',instruction,0,2034
"```dict((k, 'updated') for k, v in d.items() if v is None)```",output,1,2034
Filter a dictionary `d` to remove keys with value 'None' and replace other values with 'updated',instruction,0,2035
"```dict((k, 'updated') for k, v in d.items() if v != 'None')```",output,1,2035
count number of rows in a group `key_columns` in pandas groupby object `df`,instruction,0,2036
```df.groupby(key_columns).size()```,output,1,2036
return list `result` of sum of elements of each list `b` in list of lists `a`,instruction,0,2037
```result = [sum(b) for b in a]```,output,1,2037
What's the best way to search for a Python dictionary value in a list of dictionaries?,instruction,0,2038
```any(d['site'] == 'Superuser' for d in data)```,output,1,2038
create a 2D array of `Node` objects with dimensions `cols` columns and `rows` rows,instruction,0,2039
```nodes = [[Node() for j in range(cols)] for i in range(rows)]```,output,1,2039
replace extension '.txt' in basename '/home/user/somefile.txt' with extension '.jpg',instruction,0,2040
```print(os.path.splitext('/home/user/somefile.txt')[0] + '.jpg')```,output,1,2040
Set the resolution of a monitor as `FULLSCREEN` in pygame,instruction,0,2041
"```pygame.display.set_mode((0, 0), pygame.FULLSCREEN)```",output,1,2041
format float `3.5e+20`  to `$3.5 \\times 10^{20}$` and set as title of matplotlib plot `ax`,instruction,0,2042
"```ax.set_title('$%s \\times 10^{%s}$' % ('3.5', '+20'))```",output,1,2042
Get the age of directory (or file) `/tmp` in seconds.,instruction,0,2043
```print(os.path.getmtime('/tmp'))```,output,1,2043
how to get month name of datetime `today`,instruction,0,2044
```today.strftime('%B')```,output,1,2044
get month name from a datetime object `today`,instruction,0,2045
```today.strftime('%B')```,output,1,2045
Convert nested list `x` into a flat list,instruction,0,2046
```[j for i in x for j in i]```,output,1,2046
get each value from a list of lists `a` using itertools,instruction,0,2047
```print(list(itertools.chain.from_iterable(a)))```,output,1,2047
"convert date string 'January 11, 2010'  into day of week",instruction,0,2048
"```datetime.datetime.strptime('January 11, 2010', '%B %d, %Y').strftime('%A')```",output,1,2048
,instruction,0,2049
"```datetime.datetime.strptime('January 11, 2010', '%B %d, %Y').strftime('%a')```",output,1,2049
"remove item ""b"" in list `a`",instruction,0,2050
```a.remove('b')```,output,1,2050
remove item `c` in list `a`,instruction,0,2051
```a.remove(c)```,output,1,2051
delete the element 6 from list `a`,instruction,0,2052
```a.remove(6)```,output,1,2052
delete the element 6 from list `a`,instruction,0,2053
```a.remove(6)```,output,1,2053
delete the element `c` from list `a`,instruction,0,2054
"```if (c in a):
    a.remove(c)```",output,1,2054
delete the element `c` from list `a`,instruction,0,2055
"```try:
    a.remove(c)
except ValueError:
    pass```",output,1,2055
Get all matching patterns 'a.*?a' from a string 'a 1 a 2 a 3 a 4 a'.,instruction,0,2056
"```re.findall('(?=(a.*?a))', 'a 1 a 2 a 3 a 4 a')```",output,1,2056
outer product of each column of a 2d `X` array to form a 3d array `X`,instruction,0,2057
"```np.einsum('ij,kj->jik', X, X)```",output,1,2057
Getting the last element of list `some_list`,instruction,0,2058
```some_list[(-1)]```,output,1,2058
Getting the second to last element of list `some_list`,instruction,0,2059
```some_list[(-2)]```,output,1,2059
gets the `n` th-to-last element in list `some_list`,instruction,0,2060
```some_list[(- n)]```,output,1,2060
get the last element in list `alist`,instruction,0,2061
```alist[(-1)]```,output,1,2061
get the last element in list `astr`,instruction,0,2062
```astr[(-1)]```,output,1,2062
make a list of integers from 0 to `5` where each second element is a duplicate of the previous element,instruction,0,2063
"```print([u for v in [[i, i] for i in range(5)] for u in v])```",output,1,2063
"create a list of integers with duplicate values `[0, 0, 1, 1, 2, 2, 3, 3, 4, 4]`",instruction,0,2064
"```[0, 0, 1, 1, 2, 2, 3, 3, 4, 4]```",output,1,2064
create a list of integers from 1 to 5 with each value duplicated,instruction,0,2065
```[(i // 2) for i in range(10)]```,output,1,2065
remove first and last lines of string `s`,instruction,0,2066
```s[s.find('\n') + 1:s.rfind('\n')]```,output,1,2066
create dict of squared int values in range of 100,instruction,0,2067
```{(x ** 2) for x in range(100)}```,output,1,2067
"zip lists `[1, 2], [3, 4], [5, 6]` in a list",instruction,0,2068
"```zip(*[[1, 2], [3, 4], [5, 6]])```",output,1,2068
"zip lists in a list [[1, 2], [3, 4], [5, 6]]",instruction,0,2069
"```zip(*[[1, 2], [3, 4], [5, 6]])```",output,1,2069
request page 'https://www.mysite.com/' with credentials of username 'username' and password 'pwd',instruction,0,2070
"```requests.get('https://www.mysite.com/', auth=('username', 'pwd'))```",output,1,2070
get a new string from the 3rd character to the end of the string `x`,instruction,0,2071
```x[2:]```,output,1,2071
get a new string including the first two characters of string `x`,instruction,0,2072
```x[:2]```,output,1,2072
get a new string including all but the last character of string `x`,instruction,0,2073
```x[:(-2)]```,output,1,2073
get a new string including the last two characters of string `x`,instruction,0,2074
```x[(-2):]```,output,1,2074
get a new string with the 3rd to the second-to-last characters of string `x`,instruction,0,2075
```x[2:(-2)]```,output,1,2075
reverse a string `some_string`,instruction,0,2076
```some_string[::(-1)]```,output,1,2076
"select alternate characters of ""H-e-l-l-o- -W-o-r-l-d""",instruction,0,2077
```'H-e-l-l-o- -W-o-r-l-d'[::2]```,output,1,2077
select a substring of `s` beginning at `beginning` of length `LENGTH`,instruction,0,2078
```s = s[beginning:(beginning + LENGTH)]```,output,1,2078
terminate the program,instruction,0,2079
```sys.exit()```,output,1,2079
terminate the program,instruction,0,2080
```quit()```,output,1,2080
"Terminating a Python script with error message ""some error message""",instruction,0,2081
```sys.exit('some error message')```,output,1,2081
"encode value of key `City` in dictionary `data` as `ascii`, ignoring non-ascii characters",instruction,0,2082
"```data['City'].encode('ascii', 'ignore')```",output,1,2082
get current CPU and RAM usage,instruction,0,2083
"```psutil.cpu_percent()
psutil.virtual_memory()```",output,1,2083
get current RAM usage of current program,instruction,0,2084
"```pid = os.getpid()
py = psutil.Process(pid)
memoryUse = (py.memory_info()[0] / (2.0 ** 30))```",output,1,2084
print cpu and memory usage,instruction,0,2085
"```print((psutil.cpu_percent()))
print((psutil.virtual_memory()))```",output,1,2085
read a ragged csv file `D:/Temp/tt.csv` using `names` parameter in pandas,instruction,0,2086
"```pd.read_csv('D:/Temp/tt.csv', names=list('abcdef'))```",output,1,2086
get first non-null value per each row from dataframe `df`,instruction,0,2087
```df.stack().groupby(level=0).first()```,output,1,2087
print two numbers `10` and `20` using string formatting,instruction,0,2088
"```""""""{0} {1}"""""".format(10, 20)```",output,1,2088
"replace placeholders in string '{1} {ham} {0} {foo} {1}' with arguments `(10, 20, foo='bar', ham='spam')`",instruction,0,2089
"```""""""{1} {ham} {0} {foo} {1}"""""".format(10, 20, foo='bar', ham='spam')```",output,1,2089
create list `changed_list ` containing elements of list `original_list` whilst converting strings containing digits to integers,instruction,0,2090
```changed_list = [(int(f) if f.isdigit() else f) for f in original_list]```,output,1,2090
get a dictionary with keys from one list `keys` and values from other list `data`,instruction,0,2091
"```dict(zip(keys, zip(*data)))```",output,1,2091
convert string `apple` from iso-8859-1/latin1 to utf-8,instruction,0,2092
```apple.decode('iso-8859-1').encode('utf8')```,output,1,2092
Exclude column names when writing dataframe `df` to a csv file `filename.csv`,instruction,0,2093
"```df.to_csv('filename.csv', header=False)```",output,1,2093
"Escape character '}' in string '{0}:<15}}{1}:<15}}{2}:<8}}' while using function `format` with arguments `('1', '2', '3')`",instruction,0,2094
"```print('{0}:<15}}{1}:<15}}{2}:<8}}'.format('1', '2', '3'))```",output,1,2094
get dictionary with max value of key 'size' in list of dicts `ld`,instruction,0,2095
"```max(ld, key=lambda d: d['size'])```",output,1,2095
"format parameters 'b' and 'a' into plcaeholders in string ""{0}\\w{{2}}b{1}\\w{{2}}quarter""",instruction,0,2096
"```""""""{0}\\w{{2}}b{1}\\w{{2}}quarter"""""".format('b', 'a')```",output,1,2096
django create a foreign key column `user` and link it to table 'User',instruction,0,2097
"```user = models.ForeignKey('User', unique=True)```",output,1,2097
write a regex pattern to match even number of letter `A`,instruction,0,2098
```re.compile('^([^A]*)AA([^A]|AA)*$')```,output,1,2098
join Numpy array `b` with Numpy array 'a' along axis 0,instruction,0,2099
"```b = np.concatenate((a, a), axis=0)```",output,1,2099
custom sort an alphanumeric list `l`,instruction,0,2100
"```sorted(l, key=lambda x: x.replace('0', 'Z'))```",output,1,2100
plot logarithmic axes with matplotlib,instruction,0,2101
```ax.set_yscale('log')```,output,1,2101
"Access environment variable ""HOME""",instruction,0,2102
```os.environ['HOME']```,output,1,2102
"get value of environment variable ""HOME""",instruction,0,2103
```os.environ['HOME']```,output,1,2103
print all environment variables,instruction,0,2104
```print(os.environ)```,output,1,2104
get all environment variables,instruction,0,2105
```os.environ```,output,1,2105
get value of the environment variable 'KEY_THAT_MIGHT_EXIST',instruction,0,2106
```print(os.environ.get('KEY_THAT_MIGHT_EXIST'))```,output,1,2106
get value of the environment variable 'KEY_THAT_MIGHT_EXIST' with default value `default_value`,instruction,0,2107
"```print(os.getenv('KEY_THAT_MIGHT_EXIST', default_value))```",output,1,2107
get value of the environment variable 'HOME' with default value '/home/username/',instruction,0,2108
"```print(os.environ.get('HOME', '/home/username/'))```",output,1,2108
create a dictionary containing each string in list `my_list` split by '=' as a key/value pairs,instruction,0,2109
```print(dict([s.split('=') for s in my_list]))```,output,1,2109
find the index of element closest to number 11.5 in list `a`,instruction,0,2110
"```min(enumerate(a), key=lambda x: abs(x[1] - 11.5))```",output,1,2110
"find element `a` that contains string ""TEXT A"" in file `root`",instruction,0,2111
"```e = root.xpath('.//a[contains(text(),""TEXT A"")]')```",output,1,2111
Find the`a` tag in html `root` which starts with the text `TEXT A`  and assign it to `e`,instruction,0,2112
"```e = root.xpath('.//a[starts-with(text(),""TEXT A"")]')```",output,1,2112
find the element that holds string 'TEXT A' in file `root`,instruction,0,2113
"```e = root.xpath('.//a[text()=""TEXT A""]')```",output,1,2113
create list `c` containing items from list `b` whose index is in list `index`,instruction,0,2114
```c = [b[i] for i in index]```,output,1,2114
get the dot product of two one dimensional numpy arrays,instruction,0,2115
"```np.dot(a[:, (None)], b[(None), :])```",output,1,2115
multiplication of two 1-dimensional arrays  in numpy,instruction,0,2116
"```np.outer(a, b)```",output,1,2116
execute a file './abc.py' with arguments `arg1` and `arg2` in python shell,instruction,0,2117
"```subprocess.call(['./abc.py', arg1, arg2])```",output,1,2117
Replace NaN values in  column 'value' with the mean of data in column 'group' of dataframe `df`,instruction,0,2118
```df[['value']].fillna(df.groupby('group').transform('mean'))```,output,1,2118
separate each character in string `s` by '-',instruction,0,2119
"```re.sub('(.)(?=.)', '\\1-', s)```",output,1,2119
concatenate '-' in between characters of string `str`,instruction,0,2120
"```re.sub('(?<=.)(?=.)', '-', str)```",output,1,2120
get the indexes of the x and y axes in Numpy array `np` where variable `a` is equal to variable `value`,instruction,0,2121
"```i, j = np.where(a == value)```",output,1,2121
print letter that appears most frequently in string `s`,instruction,0,2122
```print(collections.Counter(s).most_common(1)[0])```,output,1,2122
find float number proceeding sub-string `par` in string `dir`,instruction,0,2123
"```float(re.findall('(?:^|_)' + par + '(\\d+\\.\\d*)', dir)[0])```",output,1,2123
Get all the matches from a string `abcd` if it begins with a character `a`,instruction,0,2124
"```re.findall('[^a]', 'abcd')```",output,1,2124
get a list of variables from module 'adfix.py' in current module.,instruction,0,2125
```print([item for item in dir(adfix) if not item.startswith('__')])```,output,1,2125
get the first element of each tuple in a list `rows`,instruction,0,2126
```[x[0] for x in rows]```,output,1,2126
get a list `res_list` of the first elements of each tuple in a list of tuples `rows`,instruction,0,2127
```res_list = [x[0] for x in rows]```,output,1,2127
duplicate data in pandas dataframe `x` for 5 times,instruction,0,2128
"```pd.concat([x] * 5, ignore_index=True)```",output,1,2128
Get a repeated pandas data frame object `x` by `5` times,instruction,0,2129
```pd.concat([x] * 5)```,output,1,2129
sort json `ips_data` by a key 'data_two',instruction,0,2130
"```sorted_list_of_keyvalues = sorted(list(ips_data.items()), key=item[1]['data_two'])```",output,1,2130
read json `elevations` to pandas dataframe `df`,instruction,0,2131
```pd.read_json(elevations)```,output,1,2131
"generate a random number in 1 to 7 with a given distribution [0.1, 0.05, 0.05, 0.2, 0.4, 0.2]",instruction,0,2132
"```numpy.random.choice(numpy.arange(1, 7), p=[0.1, 0.05, 0.05, 0.2, 0.4, 0.2])```",output,1,2132
Return rows of data associated with the maximum value of column 'Value' in dataframe `df`,instruction,0,2133
```df.loc[df['Value'].idxmax()]```,output,1,2133
find recurring patterns in a string '42344343434',instruction,0,2134
"```re.findall('^(.+?)((.+)\\3+)$', '42344343434')[0][:-1]```",output,1,2134
convert binary string '\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@' to numpy array,instruction,0,2135
"```np.fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@', dtype='<f4')```",output,1,2135
convert binary string to numpy array,instruction,0,2136
"```np.fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@', dtype='>f4')```",output,1,2136
"insert variables `(var1, var2, var3)` into sql statement 'INSERT INTO table VALUES (?, ?, ?)'",instruction,0,2137
"```cursor.execute('INSERT INTO table VALUES (?, ?, ?)', (var1, var2, var3))```",output,1,2137
"Execute a sql statement using variables `var1`, `var2` and `var3`",instruction,0,2138
"```cursor.execute('INSERT INTO table VALUES (%s, %s, %s)', (var1, var2, var3))```",output,1,2138
,instruction,0,2139
"```cursor.execute('INSERT INTO table VALUES (%s, %s, %s)', (var1, var2, var3))```",output,1,2139
"pandas split strings in column 'stats' by ',' into columns in dataframe `df`",instruction,0,2140
"```df['stats'].str[1:-1].str.split(',', expand=True).astype(float)```",output,1,2140
"split string in column 'stats' by ',' into separate columns in dataframe `df`",instruction,0,2141
"```df['stats'].str[1:-1].str.split(',').apply(pd.Series).astype(float)```",output,1,2141
Unpack column 'stats' in dataframe `df` into a series of columns,instruction,0,2142
```df['stats'].apply(pd.Series)```,output,1,2142
wait for shell command `p` evoked by  subprocess.Popen to complete,instruction,0,2143
```p.wait()```,output,1,2143
encode string `s` to utf-8 code,instruction,0,2144
```s.encode('utf8')```,output,1,2144
parse string '01-Jan-1995' into a datetime object using format '%d-%b-%Y',instruction,0,2145
"```datetime.datetime.strptime('01-Jan-1995', '%d-%b-%Y')```",output,1,2145
copy a file from `src` to `dst`,instruction,0,2146
"```copyfile(src, dst)```",output,1,2146
"copy file ""/dir/file.ext"" to ""/new/dir/newname.ext""",instruction,0,2147
"```shutil.copy2('/dir/file.ext', '/new/dir/newname.ext')```",output,1,2147
copy file '/dir/file.ext' to '/new/dir',instruction,0,2148
"```shutil.copy2('/dir/file.ext', '/new/dir')```",output,1,2148
print a list of integers `list_of_ints` using string formatting,instruction,0,2149
"```print(', '.join(str(x) for x in list_of_ints))```",output,1,2149
multiply column 'A' and column 'B' by column 'C' in datafram `df`,instruction,0,2150
"```df[['A', 'B']].multiply(df['C'], axis='index')```",output,1,2150
convert string 'a' to hex,instruction,0,2151
```hex(ord('a'))```,output,1,2151
Get the sum of values to the power of their indices in a list `l`,instruction,0,2152
"```sum(j ** i for i, j in enumerate(l, 1))```",output,1,2152
remove extra white spaces & tabs from a string `s`,instruction,0,2153
"```"""""" """""".join(s.split())```",output,1,2153
replace comma in string `s` with empty string '',instruction,0,2154
"```s = s.replace(',', '')```",output,1,2154
"Resample dataframe `frame` to resolution of 1 hour `1H` for timeseries index, summing values in the column `radiation` averaging those in column `tamb`",instruction,0,2155
"```frame.resample('1H').agg({'radiation': np.sum, 'tamb': np.mean})```",output,1,2155
,instruction,0,2156
```root.destroy()```,output,1,2156
create a pandas dataframe `df` from elements of a dictionary `nvalues`,instruction,0,2157
"```df = pd.DataFrame.from_dict({k: v for k, v in list(nvalues.items()) if k != 'y3'})```",output,1,2157
Flask get value of request variable 'firstname',instruction,0,2158
```first_name = request.args.get('firstname')```,output,1,2158
Flask get posted form data 'firstname',instruction,0,2159
```first_name = request.form.get('firstname')```,output,1,2159
get a list of substrings consisting of the first 5 characters of every string in list `buckets`,instruction,0,2160
```[s[:5] for s in buckets]```,output,1,2160
sort list `the_list` by the length of string followed by alphabetical order,instruction,0,2161
"```the_list.sort(key=lambda item: (-len(item), item))```",output,1,2161
Set index equal to field 'TRX_DATE' in dataframe `df`,instruction,0,2162
```df = df.set_index(['TRX_DATE'])```,output,1,2162
List comprehension with an accumulator in range of 10,instruction,0,2163
```list(accumulate(list(range(10))))```,output,1,2163
How to convert a date string '2013-1-25' in format '%Y-%m-%d' to different format '%m/%d/%y',instruction,0,2164
"```datetime.datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%m/%d/%y')```",output,1,2164
convert a date string '2013-1-25' in format '%Y-%m-%d' to different format '%-m/%d/%y',instruction,0,2165
"```datetime.datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%-m/%d/%y')```",output,1,2165
get a dataframe `df2` that contains all the columns of dataframe `df` that do not end in `prefix`,instruction,0,2166
"```df2 = df.ix[:, (~df.columns.str.endswith('prefix'))]```",output,1,2166
create list `new_list` containing the last 10 elements of list `my_list`,instruction,0,2167
```new_list = my_list[-10:]```,output,1,2167
get the last 10 elements from a list `my_list`,instruction,0,2168
```my_list[-10:]```,output,1,2168
convert matlab engine array `x` to a numpy ndarray,instruction,0,2169
```np.array(x._data).reshape(x.size[::-1]).T```,output,1,2169
select the first row grouped per level 0 of dataframe `df`,instruction,0,2170
"```df.groupby(level=0, as_index=False).nth(0)```",output,1,2170
concatenate sequence of numpy arrays  `LIST` into a one dimensional array along the first axis,instruction,0,2171
"```numpy.concatenate(LIST, axis=0)```",output,1,2171
"convert and escape string ""\\xc3\\x85あ"" to UTF-8 code",instruction,0,2172
"```""""""\\xc3\\x85"""""".encode('utf-8').decode('unicode_escape')```",output,1,2172
"encode string ""\\xc3\\x85あ"" to bytes",instruction,0,2173
"```""""""\\xc3\\x85"""""".encode('utf-8')```",output,1,2173
interleave the elements of two lists `a` and `b`,instruction,0,2174
"```[j for i in zip(a, b) for j in i]```",output,1,2174
merge two lists `a` and `b` into a single list,instruction,0,2175
"```[j for i in zip(a, b) for j in i]```",output,1,2175
delete all occureces of `8` in each string `s` in list `lst`,instruction,0,2176
"```print([s.replace('8', '') for s in lst])```",output,1,2176
"Split string `Hello` into a string of letters seperated by `,`",instruction,0,2177
"```"""""","""""".join('Hello')```",output,1,2177
"in Django, select 100 random records from the database `Content.objects`",instruction,0,2178
```Content.objects.all().order_by('?')[:100]```,output,1,2178
create a NumPy array containing elements of array `A` as pointed to by index in array `B`,instruction,0,2179
"```A[np.arange(A.shape[0])[:, (None)], B]```",output,1,2179
pivot dataframe `df` so that values for `upc` become column headings and values for `saleid` become the index,instruction,0,2180
"```df.pivot_table(index='saleid', columns='upc', aggfunc='size', fill_value=0)```",output,1,2180
match zero-or-more instances of lower case alphabet characters in a string `f233op `,instruction,0,2181
"```re.findall('([a-z]*)', 'f233op')```",output,1,2181
match zero-or-more instances of lower case alphabet characters in a string `f233op `,instruction,0,2182
"```re.findall('([a-z])*', 'f233op')```",output,1,2182
split string 'happy_hats_for_cats' using string '_for_',instruction,0,2183
"```re.split('_for_', 'happy_hats_for_cats')```",output,1,2183
"Split string 'sad_pandas_and_happy_cats_for_people' based on string 'and', 'or' or 'for'",instruction,0,2184
"```re.split('_(?:for|or|and)_', 'sad_pandas_and_happy_cats_for_people')```",output,1,2184
Split a string `l` by multiple words `for` or `or` or `and`,instruction,0,2185
"```[re.split('_(?:f?or|and)_', s) for s in l]```",output,1,2185
zip keys with individual values in lists `k` and `v`,instruction,0,2186
"```[dict(zip(k, x)) for x in v]```",output,1,2186
Sort a list 'lst' in descending order.,instruction,0,2187
"```sorted(lst, reverse=True)```",output,1,2187
"sort array `order_array` based on column 'year', 'month' and 'day'",instruction,0,2188
"```order_array.sort(order=['year', 'month', 'day'])```",output,1,2188
"Sort a structured numpy array 'df' on multiple columns 'year', 'month' and 'day'.",instruction,0,2189
"```df.sort(['year', 'month', 'day'])```",output,1,2189
check if elements in list `my_list` are coherent in order,instruction,0,2190
"```return my_list == list(range(my_list[0], my_list[-1] + 1))```",output,1,2190
group rows of pandas dataframe `df` with same 'id',instruction,0,2191
```df.groupby('id').agg(lambda x: x.tolist())```,output,1,2191
encode `u'X\xc3\xbcY\xc3\x9f'` as unicode and decode with utf-8,instruction,0,2192
```'X\xc3\xbcY\xc3\x9f'.encode('raw_unicode_escape').decode('utf-8')```,output,1,2192
parse string `a` to float,instruction,0,2193
```float(a)```,output,1,2193
Parse String `s` to Float or Int,instruction,0,2194
"```try:
    return int(s)
except ValueError:
    return float(s)```",output,1,2194
check if object `a` has property 'property',instruction,0,2195
"```if hasattr(a, 'property'):
    pass```",output,1,2195
check if object `a` has property 'property',instruction,0,2196
"```if hasattr(a, 'property'):
    pass```",output,1,2196
get the value of attribute 'property' of object `a` with default value 'default value',instruction,0,2197
"```getattr(a, 'property', 'default value')```",output,1,2197
delete every 8th column in a numpy array 'a'.,instruction,0,2198
"```np.delete(a, list(range(0, a.shape[1], 8)), axis=1)```",output,1,2198
convert `ms` milliseconds to a datetime object,instruction,0,2199
```datetime.datetime.fromtimestamp(ms / 1000.0)```,output,1,2199
find the magnitude (length) squared of a vector `vf` field,instruction,0,2200
"```np.einsum('...j,...j->...', vf, vf)```",output,1,2200
request http url `url`,instruction,0,2201
```r = requests.get(url)```,output,1,2201
request http url `url` with parameters `payload`,instruction,0,2202
"```r = requests.get(url, params=payload)```",output,1,2202
post request url `url` with parameters `payload`,instruction,0,2203
"```r = requests.post(url, data=payload)```",output,1,2203
make an HTTP post request with data `post_data`,instruction,0,2204
"```post_response = requests.post(url='http://httpbin.org/post', json=post_data)```",output,1,2204
django jinja slice list `mylist` by '3:8',instruction,0,2205
```{{(mylist | slice): '3:8'}}```,output,1,2205
create dataframe `df` with content of hdf store file '/home/.../data.h5' with key of 'firstSet',instruction,0,2206
"```df1 = pd.read_hdf('/home/.../data.h5', 'firstSet')```",output,1,2206
get the largest index of the last occurrence of characters '([{' in string `test_string`,instruction,0,2207
```max(test_string.rfind(i) for i in '([{')```,output,1,2207
print 'here is your checkmark: ' plus unicode character u'\u2713',instruction,0,2208
```print('here is your checkmark: ' + '\u2713')```,output,1,2208
print unicode characters in a string `\u0420\u043e\u0441\u0441\u0438\u044f`,instruction,0,2209
```print('\u0420\u043e\u0441\u0441\u0438\u044f')```,output,1,2209
pads string '5' on the left with 1 zero,instruction,0,2210
```print('{0}'.format('5'.zfill(2)))```,output,1,2210
Remove duplicates elements from list `sequences` and sort it in ascending order,instruction,0,2211
```sorted(set(itertools.chain.from_iterable(sequences)))```,output,1,2211
pandas dataframe `df` column 'a' to list,instruction,0,2212
```df['a'].values.tolist()```,output,1,2212
Get a list of all values in column `a` in pandas data frame `df`,instruction,0,2213
```df['a'].tolist()```,output,1,2213
escaping quotes in string,instruction,0,2214
"```replace('""', '\\""')```",output,1,2214
check if all string elements in list `words` are upper-cased,instruction,0,2215
```print(all(word[0].isupper() for word in words))```,output,1,2215
remove items from dictionary `myDict` if the item's value `val` is equal to 42,instruction,0,2216
"```myDict = {key: val for key, val in list(myDict.items()) if val != 42}```",output,1,2216
Remove all items from a dictionary `myDict` whose values are `42`,instruction,0,2217
"```{key: val for key, val in list(myDict.items()) if val != 42}```",output,1,2217
Determine the byte length of a utf-8 encoded string `s`,instruction,0,2218
```return len(s.encode('utf-8'))```,output,1,2218
kill a process with id `process.pid`,instruction,0,2219
"```os.kill(process.pid, signal.SIGKILL)```",output,1,2219
get data of columns with Null values in dataframe `df`,instruction,0,2220
```df[pd.isnull(df).any(axis=1)]```,output,1,2220
"strip everything up to and including the character `&` from url `url`, strip the character `=` from the remaining string and concatenate `.html` to the end",instruction,0,2221
"```url.split('&')[-1].replace('=', '') + '.html'```",output,1,2221
Parse a file `sample.xml` using expat parsing in python 3,instruction,0,2222
"```parser.ParseFile(open('sample.xml', 'rb'))```",output,1,2222
Exit script,instruction,0,2223
```sys.exit()```,output,1,2223
assign value in `group` dynamically to class property `attr`,instruction,0,2224
"```setattr(self, attr, group)```",output,1,2224
decode url-encoded string `some_string` to its character equivalents,instruction,0,2225
```urllib.parse.unquote(urllib.parse.unquote(some_string))```,output,1,2225
"decode a double URL encoded string 
'FireShot3%2B%25282%2529.png' to
'FireShot3+(2).png'",instruction,0,2226
```urllib.parse.unquote(urllib.parse.unquote('FireShot3%2B%25282%2529.png'))```,output,1,2226
change flask security register url to `/create_account`,instruction,0,2227
```app.config['SECURITY_REGISTER_URL'] = '/create_account'```,output,1,2227
open a file `/home/user/test/wsservice/data.pkl` in binary write mode,instruction,0,2228
"```output = open('/home/user/test/wsservice/data.pkl', 'wb')```",output,1,2228
remove the last element in list `a`,instruction,0,2229
```del a[(-1)]```,output,1,2229
remove the element in list `a` with index 1,instruction,0,2230
```a.pop(1)```,output,1,2230
remove the last element in list `a`,instruction,0,2231
```a.pop()```,output,1,2231
remove the element in list `a` at index `index`,instruction,0,2232
```a.pop(index)```,output,1,2232
remove the element in list `a` at index `index`,instruction,0,2233
```del a[index]```,output,1,2233
print a celsius symbol on x axis of a plot `ax`,instruction,0,2234
```ax.set_xlabel('Temperature (\u2103)')```,output,1,2234
Print a celsius symbol with matplotlib,instruction,0,2235
```ax.set_xlabel('Temperature ($^\\circ$C)')```,output,1,2235
convert a list of lists `list_of_lists` into a list of strings keeping empty sub-lists as empty string '',instruction,0,2236
```[''.join(l) for l in list_of_lists]```,output,1,2236
get a list of all the duplicate items in dataframe `df` using pandas,instruction,0,2237
"```pd.concat(g for _, g in df.groupby('ID') if len(g) > 1)```",output,1,2237
Delete third row in a numpy array `x`,instruction,0,2238
"```x = numpy.delete(x, 2, axis=1)```",output,1,2238
delete first row of array `x`,instruction,0,2239
"```x = numpy.delete(x, 0, axis=0)```",output,1,2239
merge rows from dataframe `df1` with rows from dataframe `df2` and calculate the mean for rows that have the same value of axis 1,instruction,0,2240
"```pd.concat((df1, df2), axis=1).mean(axis=1)```",output,1,2240
Get the average values from two numpy arrays `old_set` and `new_set`,instruction,0,2241
"```np.mean(np.array([old_set, new_set]), axis=0)```",output,1,2241
Matplotlib change marker size to 500,instruction,0,2242
"```scatter(x, y, s=500, color='green', marker='h')```",output,1,2242
Create new list `result` by splitting each item in list `words`,instruction,0,2243
"```result = [item for word in words for item in word.split(',')]```",output,1,2243
convert JSON string '2012-05-29T19:30:03.283Z' into a DateTime object using format '%Y-%m-%dT%H:%M:%S.%fZ',instruction,0,2244
"```datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ')```",output,1,2244
count `True` values associated with key 'one' in dictionary `tadas`,instruction,0,2245
```sum(item['one'] for item in list(tadas.values()))```,output,1,2245
encode a pdf file `pdf_reference.pdf` with `base64` encoding,instruction,0,2246
"```a = open('pdf_reference.pdf', 'rb').read().encode('base64')```",output,1,2246
split string `a` using new-line character '\n' as separator,instruction,0,2247
```a.rstrip().split('\n')```,output,1,2247
split a string `a` with new line character,instruction,0,2248
```a.split('\n')[:-1]```,output,1,2248
return http status code 204 from a django view,instruction,0,2249
```return HttpResponse(status=204)```,output,1,2249
check if 7 is in `a`,instruction,0,2250
```(7 in a)```,output,1,2250
check if 'a' is in list `a`,instruction,0,2251
```('a' in a)```,output,1,2251
sort list `results` by keys value 'year',instruction,0,2252
"```sorted(results, key=itemgetter('year'))```",output,1,2252
get current url in selenium webdriver `browser`,instruction,0,2253
```print(browser.current_url)```,output,1,2253
"split string `str` with delimiter '; ' or delimiter ', '",instruction,0,2254
"```re.split('; |, ', str)```",output,1,2254
un-escaping characters in a string with python,instruction,0,2255
"```""""""\\u003Cp\\u003E"""""".decode('unicode-escape')```",output,1,2255
convert date string `s` in format pattern '%d/%m/%Y' into a timestamp,instruction,0,2256
"```time.mktime(datetime.datetime.strptime(s, '%d/%m/%Y').timetuple())```",output,1,2256
convert string '01/12/2011' to an integer timestamp,instruction,0,2257
"```int(datetime.datetime.strptime('01/12/2011', '%d/%m/%Y').strftime('%s'))```",output,1,2257
get http header of the key 'your-header-name' in flask,instruction,0,2258
```request.headers['your-header-name']```,output,1,2258
select records of dataframe `df` where the sum of column 'X' for each value in column 'User' is 0,instruction,0,2259
```df.groupby('User')['X'].filter(lambda x: x.sum() == 0)```,output,1,2259
Get data of dataframe `df` where the sum of column 'X' grouped by column 'User' is equal to 0,instruction,0,2260
```df.loc[df.groupby('User')['X'].transform(sum) == 0]```,output,1,2260
Get data from dataframe `df` where column 'X' is equal to 0,instruction,0,2261
```df.groupby('User')['X'].transform(sum) == 0```,output,1,2261
,instruction,0,2262
"```driver.find_elements_by_xpath(""//*[contains(text(), 'My Button')]"")```",output,1,2262
convert pandas group by object to multi-indexed dataframe with indices 'Name' and 'Destination',instruction,0,2263
"```df.set_index(['Name', 'Destination'])```",output,1,2263
coalesce non-word-characters in string `a`,instruction,0,2264
"```print(re.sub('(\\W)\\1+', '\\1', a))```",output,1,2264
"open a file ""$file"" under Unix",instruction,0,2265
"```os.system('start ""$file""')```",output,1,2265
Convert a Unicode string `title` to a 'ascii' string,instruction,0,2266
"```unicodedata.normalize('NFKD', title).encode('ascii', 'ignore')```",output,1,2266
Convert a Unicode string `a` to a 'ascii' string,instruction,0,2267
"```a.encode('ascii', 'ignore')```",output,1,2267
create a list `files` containing all files in directory '.' that starts with numbers between 0 and 9 and ends with the extension '.jpg',instruction,0,2268
"```files = [f for f in os.listdir('.') if re.match('[0-9]+.*\\.jpg', f)]```",output,1,2268
"adding a 1-d array `[1, 2, 3, 4, 5, 6, 7, 8, 9]` to a 3-d array `np.zeros((6, 9, 20))`",instruction,0,2269
"```np.zeros((6, 9, 20)) + np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])[(None), :, (None)]```",output,1,2269
"add array of shape `(6, 9, 20)` to array `[1, 2, 3, 4, 5, 6, 7, 8, 9]`",instruction,0,2270
"```np.zeros((6, 9, 20)) + np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]).reshape((1, 9, 1))```",output,1,2270
,instruction,0,2271
```os.system('start excel.exe <path/to/file>')```,output,1,2271
get the list with the highest sum value in list `x`,instruction,0,2272
"```print(max(x, key=sum))```",output,1,2272
sum the length of lists in list `x` that are more than 1 item in length,instruction,0,2273
```sum(len(y) for y in x if len(y) > 1)```,output,1,2273
Enclose numbers in quotes in a string `This is number 1 and this is number 22`,instruction,0,2274
"```re.sub('(\\d+)', '""\\1""', 'This is number 1 and this is number 22')```",output,1,2274
multiply the columns of sparse matrix `m` by array `a` then multiply the rows of the resulting matrix by array `a`,instruction,0,2275
"```numpy.dot(numpy.dot(a, m), a)```",output,1,2275
Django check if an object with criteria `name` equal to 'name' and criteria `title` equal to 'title' exists in model `Entry`,instruction,0,2276
"```Entry.objects.filter(name='name', title='title').exists()```",output,1,2276
"sort a nested list by the inverse of element 2, then by element 1",instruction,0,2277
"```sorted(l, key=lambda x: (-int(x[1]), x[0]))```",output,1,2277
get domain/host name from request object in Django,instruction,0,2278
```request.META['HTTP_HOST']```,output,1,2278
"get a string `randomkey123xyz987` between two substrings in a string `api('randomkey123xyz987', 'key', 'text')` using regex",instruction,0,2279
"```re.findall(""api\\('(.*?)'"", ""api('randomkey123xyz987', 'key', 'text')"")```",output,1,2279
invoke perl script './uireplace.pl' using perl interpeter '/usr/bin/perl' and send argument `var` to it,instruction,0,2280
"```subprocess.call(['/usr/bin/perl', './uireplace.pl', var])```",output,1,2280
print list of items `myList`,instruction,0,2281
```print('\n'.join(str(p) for p in myList))```,output,1,2281
update the dictionary `mydic` with dynamic keys `i` and values with key 'name' from dictionary `o`,instruction,0,2282
```mydic.update({i: o['name']})```,output,1,2282
split a `utf-8` encoded string `stru` into a list of characters,instruction,0,2283
```list(stru.decode('utf-8'))```,output,1,2283
convert utf-8 with bom string `s` to utf-8 with no bom `u`,instruction,0,2284
```u = s.decode('utf-8-sig')```,output,1,2284
Filter model 'Entry' where 'id' is not equal to 3 in Django,instruction,0,2285
```Entry.objects.filter(~Q(id=3))```,output,1,2285
lookup an attribute in any scope by name 'range',instruction,0,2286
"```getattr(__builtins__, 'range')```",output,1,2286
restart a computer after `900` seconds using subprocess,instruction,0,2287
"```subprocess.call(['shutdown', '/r', '/t', '900'])```",output,1,2287
shutdown a computer using subprocess,instruction,0,2288
"```subprocess.call(['shutdown', '/s'])```",output,1,2288
abort a computer shutdown using subprocess,instruction,0,2289
"```subprocess.call(['shutdown', '/a '])```",output,1,2289
logoff computer having windows operating system using python,instruction,0,2290
"```subprocess.call(['shutdown', '/l '])```",output,1,2290
shutdown and restart a computer running windows from script,instruction,0,2291
"```subprocess.call(['shutdown', '/r'])```",output,1,2291
erase the contents of a file `filename`,instruction,0,2292
"```open('filename', 'w').close()```",output,1,2292
,instruction,0,2293
"```open('file.txt', 'w').close()```",output,1,2293
convert dataframe `df` to list of dictionaries including the index values,instruction,0,2294
```df.to_dict('index')```,output,1,2294
Create list of dictionaries from pandas dataframe `df`,instruction,0,2295
```df.to_dict('records')```,output,1,2295
Group a pandas data frame by monthly frequenct `M` using groupby,instruction,0,2296
```df.groupby(pd.TimeGrouper(freq='M'))```,output,1,2296
divide the members of a list `conversions` by the corresponding members of another list `trials`,instruction,0,2297
"```[(c / t) for c, t in zip(conversions, trials)]```",output,1,2297
sort dict `data` by value,instruction,0,2298
"```sorted(data, key=data.get)```",output,1,2298
Sort a dictionary `data` by its values,instruction,0,2299
```sorted(data.values())```,output,1,2299
Get a list of pairs of key-value sorted by values in dictionary `data`,instruction,0,2300
"```sorted(list(data.items()), key=lambda x: x[1])```",output,1,2300
,instruction,0,2301
"```sorted(list(data.items()), key=lambda x: x[1])```",output,1,2301
display current time,instruction,0,2302
```now = datetime.datetime.now().strftime('%H:%M:%S')```,output,1,2302
find the index of the second occurrence of the substring `bar` in string `foo bar bar bar`,instruction,0,2303
"```""""""foo bar bar bar"""""".replace('bar', 'XXX', 1).find('bar')```",output,1,2303
check if key 'stackoverflow' and key 'google' are presented in dictionary `sites`,instruction,0,2304
"```set(['stackoverflow', 'google']).issubset(sites)```",output,1,2304
replace string ' and ' in string `stuff` with character '/',instruction,0,2305
"```stuff.replace(' and ', '/')```",output,1,2305
"Save array at index 0, index 1 and index 8 of array `np` to tmp file `tmp`",instruction,0,2306
"```np.savez(tmp, *[getarray[0], getarray[1], getarray[8]])```",output,1,2306
substract 1 hour and 10 minutes from current time,instruction,0,2307
"```t = datetime.datetime.now()
(t - datetime.timedelta(hours=1, minutes=10))```",output,1,2307
subtract 1 hour and 10 minutes from time object `t`,instruction,0,2308
"```(t - datetime.timedelta(hours=1, minutes=10))```",output,1,2308
add 1 hour and 2 minutes to time object `t`,instruction,0,2309
"```dt = datetime.datetime.combine(datetime.date.today(), t)```",output,1,2309
subtract 5 hours from the time object `dt`,instruction,0,2310
```dt -= datetime.timedelta(hours=5)```,output,1,2310
encode string `data` using hex 'hex' encoding,instruction,0,2311
```print(data.encode('hex'))```,output,1,2311
Return the decimal value for each hex character in data `data`,instruction,0,2312
```print(' '.join([str(ord(a)) for a in data]))```,output,1,2312
Get all the items from a list of tuple 'l' where second item in tuple is '1'.,instruction,0,2313
```[x for x in l if x[1] == 1]```,output,1,2313
Create array `a` containing integers from stdin,instruction,0,2314
```a.fromlist([int(val) for val in stdin.read().split()])```,output,1,2314
place '\' infront of each non-letter char in string `line`,instruction,0,2315
"```print(re.sub('[_%^$]', '\\\\\\g<0>', line))```",output,1,2315
Get all `a` tags where the text starts with value `some text` using regex,instruction,0,2316
"```doc.xpath(""//a[starts-with(text(),'some text')]"")```",output,1,2316
convert a list of lists `a` into list of tuples of appropriate elements form nested lists,instruction,0,2317
```zip(*a)```,output,1,2317
convert a list of strings `lst` to list of integers,instruction,0,2318
"```[map(int, sublist) for sublist in lst]```",output,1,2318
convert strings in list-of-lists `lst` to ints,instruction,0,2319
```[[int(x) for x in sublist] for sublist in lst]```,output,1,2319
get index of elements in array `A` that occur in another array `B`,instruction,0,2320
"```np.where(np.in1d(A, B))[0]```",output,1,2320
create a list where each element is a dictionary with keys 'key1' and 'key2' and values corresponding to each value in the lists referenced by keys 'key1' and 'key2' in dictionary `d`,instruction,0,2321
"```[{'key1': a, 'key2': b} for a, b in zip(d['key1'], d['key2'])]```",output,1,2321
,instruction,0,2322
"```map(dict, zip(*[[(k, v) for v in value] for k, value in list(d.items())]))```",output,1,2322
Get Last Day of the first month in 2002,instruction,0,2323
"```calendar.monthrange(2002, 1)```",output,1,2323
Get Last Day of the second month in 2002,instruction,0,2324
"```calendar.monthrange(2008, 2)```",output,1,2324
Get Last Day of the second month in 2100,instruction,0,2325
"```calendar.monthrange(2100, 2)```",output,1,2325
Get Last Day of the month `month` in year `year`,instruction,0,2326
"```calendar.monthrange(year, month)[1]```",output,1,2326
Get Last Day of the second month in year 2012,instruction,0,2327
"```monthrange(2012, 2)```",output,1,2327
Get Last Day of the first month in year 2000,instruction,0,2328
"```(datetime.date(2000, 2, 1) - datetime.timedelta(days=1))```",output,1,2328
"Calling an external command ""ls -l""",instruction,0,2329
```from subprocess import call```,output,1,2329
"Calling an external command ""some_command with args""",instruction,0,2330
```os.system('some_command with args')```,output,1,2330
"Calling an external command ""some_command < input_file | another_command > output_file""",instruction,0,2331
```os.system('some_command < input_file | another_command > output_file')```,output,1,2331
"Calling an external command ""some_command with args""",instruction,0,2332
```stream = os.popen('some_command with args')```,output,1,2332
"Calling an external command ""echo Hello World""",instruction,0,2333
"```print(subprocess.Popen('echo Hello World', shell=True, stdout=subprocess.PIPE).stdout.read())```",output,1,2333
"Calling an external command ""echo Hello World""",instruction,0,2334
```print(os.popen('echo Hello World').read())```,output,1,2334
"Calling an external command ""echo Hello World""",instruction,0,2335
"```return_code = subprocess.call('echo Hello World', shell=True)```",output,1,2335
"Calling an external command ""ls""",instruction,0,2336
"```p = subprocess.Popen('ls', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
    print(line, end=' ')
retval = p.wait()```",output,1,2336
"Calling an external command ""ls -l""",instruction,0,2337
"```call(['ls', '-l'])```",output,1,2337
decode url `url` with utf8 and print it,instruction,0,2338
```print(urllib.parse.unquote(url).decode('utf8'))```,output,1,2338
decode a urllib escaped url string `url` with `utf8`,instruction,0,2339
```url = urllib.parse.unquote(url).decode('utf8')```,output,1,2339
delete letters from string '12454v',instruction,0,2340
"```"""""""""""".join(filter(str.isdigit, '12454v'))```",output,1,2340
Update row values for a column `Season` using vectorized string operation in pandas,instruction,0,2341
```df['Season'].str.split('-').str[0].astype(int)```,output,1,2341
sort a list of tuples `my_list` by second parameter in the tuple,instruction,0,2342
```my_list.sort(key=lambda x: x[1])```,output,1,2342
find indexes of all occurrences of a substring `tt` in a string `ttt`,instruction,0,2343
"```[m.start() for m in re.finditer('(?=tt)', 'ttt')]```",output,1,2343
find all occurrences of a substring in a string,instruction,0,2344
"```[m.start() for m in re.finditer('test', 'test test test test')]```",output,1,2344
split string `s` based on white spaces,instruction,0,2345
"```re.findall('\\s+|\\S+', s)```",output,1,2345
"set columns `['race_date', 'track_code', 'race_number']` as indexes in dataframe `rdata`",instruction,0,2346
"```rdata.set_index(['race_date', 'track_code', 'race_number'])```",output,1,2346
recursively go through all subdirectories and files in `rootdir`,instruction,0,2347
"```for (root, subFolders, files) in os.walk(rootdir):
    pass```",output,1,2347
sort a list of dictionary values by 'date' in reverse order,instruction,0,2348
"```list.sort(key=lambda item: item['date'], reverse=True)```",output,1,2348
display first 5 characters of string 'aaabbbccc',instruction,0,2349
"```""""""{:.5}"""""".format('aaabbbccc')```",output,1,2349
unpack hexadecimal string `s` to a list of integer values,instruction,0,2350
"```struct.unpack('11B', s)```",output,1,2350
"finding the index of an item 'foo' given a list `['foo', 'bar', 'baz']` containing it",instruction,0,2351
"```[i for i, j in enumerate(['foo', 'bar', 'baz']) if j == 'foo']```",output,1,2351
"generate all permutations of list `[1, 2, 3]` and list `[4, 5, 6]`",instruction,0,2352
"```print(list(itertools.product([1, 2, 3], [4, 5, 6])))```",output,1,2352
"generate all permutations of a list `[1, 2, 3]`",instruction,0,2353
"```itertools.permutations([1, 2, 3])```",output,1,2353
substitute occurrences of unicode regex pattern u'\\p{P}+' with empty string '' in string `text`,instruction,0,2354
"```return re.sub('\\p{P}+', '', text)```",output,1,2354
manually throw/raise a `ValueError` exception with the message 'A very specific bad thing happened',instruction,0,2355
```raise ValueError('A very specific bad thing happened')```,output,1,2355
"throw an exception ""I know Python!""",instruction,0,2356
```raise Exception('I know Python!')```,output,1,2356
"Manually throw an exception ""I know python!""",instruction,0,2357
```raise Exception('I know python!')```,output,1,2357
"throw a ValueError with message 'represents a hidden bug, do not catch this'",instruction,0,2358
"```raise ValueError('represents a hidden bug, do not catch this')```",output,1,2358
throw an Exception with message 'This is the exception you expect to handle',instruction,0,2359
```raise Exception('This is the exception you expect to handle')```,output,1,2359
"throw a value error with message 'A very specific bad thing happened', 'foo', 'bar', 'baz'",instruction,0,2360
```raise ValueError('A very specific bad thing happened')```,output,1,2360
throw a runtime error with message 'specific message',instruction,0,2361
```raise RuntimeError('specific message')```,output,1,2361
"throw an assertion error with message ""Unexpected value of 'distance'!"", distance",instruction,0,2362
"```raise AssertionError(""Unexpected value of 'distance'!"", distance)```",output,1,2362
"if Selenium textarea element `foo` is not empty, clear the field",instruction,0,2363
```driver.find_element_by_id('foo').clear()```,output,1,2363
clear text from textarea 'foo' with selenium,instruction,0,2364
```driver.find_element_by_id('foo').clear()```,output,1,2364
convert a number 2130706433 to ip string,instruction,0,2365
"```socket.inet_ntoa(struct.pack('!L', 2130706433))```",output,1,2365
"Rearrange the columns 'a','b','x','y' of pandas DataFrame `df` in mentioned sequence 'x' ,'y','a' ,'b'",instruction,0,2366
"```df = df[['x', 'y', 'a', 'b']]```",output,1,2366
call base class's __init__ method from the child class `ChildClass`,instruction,0,2367
"```super(ChildClass, self).__init__(*args, **kwargs)```",output,1,2367
sum of all values in a python dict `d`,instruction,0,2368
```sum(d.values())```,output,1,2368
,instruction,0,2369
```sum(d.values())```,output,1,2369
convert python dictionary `your_data` to json array,instruction,0,2370
"```json.dumps(your_data, ensure_ascii=False)```",output,1,2370
assign an array of floats in range from 0 to 100 to a variable `values`,instruction,0,2371
"```values = np.array([i for i in range(100)], dtype=np.float64)```",output,1,2371
sort a list of dictionaries `list_of_dct` by values in an order `order`,instruction,0,2372
"```sorted(list_of_dct, key=lambda x: order.index(list(x.values())[0]))```",output,1,2372
change the case of the first letter in string `s`,instruction,0,2373
```return s[0].upper() + s[1:]```,output,1,2373
"join list of numbers `[1,2,3,4] ` to string of numbers.",instruction,0,2374
"```"""""""""""".join([1, 2, 3, 4])```",output,1,2374
delete every non `utf-8` characters from a string `line`,instruction,0,2375
"```line = line.decode('utf-8', 'ignore').encode('utf-8')```",output,1,2375
execute a command `command ` in the terminal from a python script,instruction,0,2376
```os.system(command)```,output,1,2376
MySQL execute query 'SELECT * FROM foo WHERE bar = %s AND baz = %s' with parameters `param1` and `param2`,instruction,0,2377
"```c.execute('SELECT * FROM foo WHERE bar = %s AND baz = %s', (param1, param2))```",output,1,2377
Parse string `datestr` into a datetime object using format pattern '%Y-%m-%d',instruction,0,2378
"```dateobj = datetime.datetime.strptime(datestr, '%Y-%m-%d').date()```",output,1,2378