message_type
stringclasses 2
values | message
stringlengths 2
232
⌀ | message_id
int64 0
1
| conversation_id
int64 0
2.38k
|
---|---|---|---|
instruction
|
subprocess run command 'start command -flags arguments' through the shell
| 0 | 200 |
output
|
subprocess.call('start command -flags arguments', shell=True)
| 1 | 200 |
instruction
|
run command 'command -flags arguments &' on command line tools as separate processes
| 0 | 201 |
output
|
subprocess.call('command -flags arguments &', shell=True)
| 1 | 201 |
instruction
|
replace percent-encoded code in request `f` to their single-character equivalent
| 0 | 202 |
output
|
f = urllib.request.urlopen(url, urllib.parse.unquote(urllib.parse.urlencode(params)))
| 1 | 202 |
instruction
|
remove white spaces from the end of string " xyz "
| 0 | 203 |
output
|
""" xyz """.rstrip()
| 1 | 203 |
instruction
|
Replace special characters in utf-8 encoded string `s` using the %xx escape
| 0 | 204 |
output
|
urllib.parse.quote(s.encode('utf-8'))
| 1 | 204 |
instruction
| null | 0 | 205 |
output
|
urllib.parse.quote_plus('a b')
| 1 | 205 |
instruction
|
Create an array containing the conversion of string '100110' into separate elements
| 0 | 206 |
output
|
np.array(map(int, '100110'))
| 1 | 206 |
instruction
|
convert a string 'mystr' to numpy array of integer values
| 0 | 207 |
output
|
print(np.array(list(mystr), dtype=int))
| 1 | 207 |
instruction
|
convert an rgb image 'messi5.jpg' into grayscale `img`
| 0 | 208 |
output
|
img = cv2.imread('messi5.jpg', 0)
| 1 | 208 |
instruction
|
sort list `lst` in descending order based on the second item of each tuple in it
| 0 | 209 |
output
|
lst.sort(key=lambda x: x[2], reverse=True)
| 1 | 209 |
instruction
| null | 0 | 210 |
output
|
indices = [i for i, x in enumerate(my_list) if x == 'whatever']
| 1 | 210 |
instruction
|
execute shell command 'grep -r PASSED *.log | sort -u | wc -l' with a | pipe in it
| 0 | 211 |
output
|
subprocess.call('grep -r PASSED *.log | sort -u | wc -l', shell=True)
| 1 | 211 |
instruction
|
count the number of trailing question marks in string `my_text`
| 0 | 212 |
output
|
len(my_text) - len(my_text.rstrip('?'))
| 1 | 212 |
instruction
|
remove dollar sign '$' from second to last column data in dataframe 'df' and convert the data into floats
| 0 | 213 |
output
|
df[df.columns[1:]].replace('[\\$,]', '', regex=True).astype(float)
| 1 | 213 |
instruction
|
Merge column 'word' in dataframe `df2` with column 'word' on dataframe `df1`
| 0 | 214 |
output
|
df1.merge(df2, how='left', on='word')
| 1 | 214 |
instruction
|
switch positions of each two adjacent characters in string `a`
| 0 | 215 |
output
|
print(''.join(''.join(i) for i in zip(a2, a1)) + a[-1] if len(a) % 2 else '')
| 1 | 215 |
instruction
|
make a window `root` jump to the front
| 0 | 216 |
output
|
root.attributes('-topmost', True)
| 1 | 216 |
instruction
|
make a window `root` jump to the front
| 0 | 217 |
output
|
root.lift()
| 1 | 217 |
instruction
|
Convert list of booleans `walls` into a hex string
| 0 | 218 |
output
|
hex(int(''.join([str(int(b)) for b in walls]), 2))
| 1 | 218 |
instruction
|
convert the sum of list `walls` into a hex presentation
| 0 | 219 |
output
|
hex(sum(b << i for i, b in enumerate(reversed(walls))))
| 1 | 219 |
instruction
|
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.
| 0 | 220 |
output
|
print(('Total score for', name, 'is', score))
| 1 | 220 |
instruction
|
print multiple arguments 'name' and 'score'.
| 0 | 221 |
output
|
print('Total score for {} is {}'.format(name, score))
| 1 | 221 |
instruction
|
print a string using multiple strings `name` and `score`
| 0 | 222 |
output
|
print('Total score for %s is %s ' % (name, score))
| 1 | 222 |
instruction
|
print string including multiple variables `name` and `score`
| 0 | 223 |
output
|
print(('Total score for', name, 'is', score))
| 1 | 223 |
instruction
|
serve a static html page 'your_template.html' at the root of a django project
| 0 | 224 |
output
|
url('^$', TemplateView.as_view(template_name='your_template.html'))
| 1 | 224 |
instruction
|
use a list of values `[3,6]` to select rows from a pandas dataframe `df`'s column 'A'
| 0 | 225 |
output
|
df[df['A'].isin([3, 6])]
| 1 | 225 |
instruction
| null | 0 | 226 |
output
|
instance.__class__.__name__
| 1 | 226 |
instruction
|
execute python code `myscript.py` in a virtualenv `/path/to/my/venv` from matlab
| 0 | 227 |
output
|
system('/path/to/my/venv/bin/python myscript.py')
| 1 | 227 |
instruction
|
django return a QuerySet list containing the values of field 'eng_name' in model `Employees`
| 0 | 228 |
output
|
Employees.objects.values_list('eng_name', flat=True)
| 1 | 228 |
instruction
|
find all digits in string '6,7)' and put them to a list
| 0 | 229 |
output
|
re.findall('\\d|\\d,\\d\\)', '6,7)')
| 1 | 229 |
instruction
|
prompt string 'Press Enter to continue...' to the console
| 0 | 230 |
output
|
input('Press Enter to continue...')
| 1 | 230 |
instruction
|
print string "ABC" as hex literal
| 0 | 231 |
output
|
"""ABC""".encode('hex')
| 1 | 231 |
instruction
|
insert a new field 'geolocCountry' on an existing document 'b' using pymongo
| 0 | 232 |
output
|
db.Doc.update({'_id': b['_id']}, {'$set': {'geolocCountry': myGeolocCountry}})
| 1 | 232 |
instruction
|
Write a regex statement to match 'lol' to 'lolllll'.
| 0 | 233 |
output
|
re.sub('l+', 'l', 'lollll')
| 1 | 233 |
instruction
|
BeautifulSoup find all 'tr' elements in HTML string `soup` at the five stride starting from the fourth element
| 0 | 234 |
output
|
rows = soup.findAll('tr')[4::5]
| 1 | 234 |
instruction
|
reverse all x-axis points in pyplot
| 0 | 235 |
output
|
plt.gca().invert_xaxis()
| 1 | 235 |
instruction
|
reverse y-axis in pyplot
| 0 | 236 |
output
|
plt.gca().invert_yaxis()
| 1 | 236 |
instruction
|
stack two dataframes next to each other in pandas
| 0 | 237 |
output
|
pd.concat([GOOG, AAPL], keys=['GOOG', 'AAPL'], axis=1)
| 1 | 237 |
instruction
|
create a json response `response_data`
| 0 | 238 |
output
|
return HttpResponse(json.dumps(response_data), content_type='application/json')
| 1 | 238 |
instruction
|
decode escape sequences in string `myString`
| 0 | 239 |
output
|
myString.decode('string_escape')
| 1 | 239 |
instruction
|
calculate the md5 checksum of a file named 'filename.exe'
| 0 | 240 |
output
|
hashlib.md5(open('filename.exe', 'rb').read()).hexdigest()
| 1 | 240 |
instruction
|
Find all keys from a dictionary `d` whose values are `desired_value`
| 0 | 241 |
output
|
[k for k, v in d.items() if v == desired_value]
| 1 | 241 |
instruction
|
create a set containing all keys' names from dictionary `LoD`
| 0 | 242 |
output
|
{k for d in LoD for k in list(d.keys())}
| 1 | 242 |
instruction
|
create a set containing all keys names from list of dictionaries `LoD`
| 0 | 243 |
output
|
set([i for s in [list(d.keys()) for d in LoD] for i in s])
| 1 | 243 |
instruction
|
extract all keys from a list of dictionaries `LoD`
| 0 | 244 |
output
|
[i for s in [list(d.keys()) for d in LoD] for i in s]
| 1 | 244 |
instruction
|
unpack keys and values of a dictionary `d` into two lists
| 0 | 245 |
output
|
keys, values = zip(*list(d.items()))
| 1 | 245 |
instruction
|
convert a string `s` containing a decimal to an integer
| 0 | 246 |
output
|
int(Decimal(s))
| 1 | 246 |
instruction
| null | 0 | 247 |
output
|
int(s.split('.')[0])
| 1 | 247 |
instruction
|
check if array `b` contains all elements of array `a`
| 0 | 248 |
output
|
numpy.in1d(b, a).all()
| 1 | 248 |
instruction
|
numpy: check if array 'a' contains all the numbers in array 'b'.
| 0 | 249 |
output
|
numpy.array([(x in a) for x in b])
| 1 | 249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.