message_type
stringclasses 2
values | message
stringlengths 2
232
⌀ | message_id
int64 0
1
| conversation_id
int64 0
2.38k
|
---|---|---|---|
instruction
|
check if string `foo` is UTF-8 encoded
| 0 | 650 |
output
|
foo.decode('utf8').encode('utf8')
| 1 | 650 |
instruction
|
get the dimensions of numpy array `a`
| 0 | 651 |
output
|
a.shape
| 1 | 651 |
instruction
|
get the dimensions of numpy array `a`
| 0 | 652 |
output
|
N.shape(a)
| 1 | 652 |
instruction
|
get the dimensions of array `a`
| 0 | 653 |
output
|
N.shape(a)
| 1 | 653 |
instruction
|
get the dimensions of numpy array `a`
| 0 | 654 |
output
|
a.shape
| 1 | 654 |
instruction
|
get the indices of tuples in list of tuples `L` where the first value is 53
| 0 | 655 |
output
|
[i for i, v in enumerate(L) if v[0] == 53]
| 1 | 655 |
instruction
|
convert string of bytes `y\xcc\xa6\xbb` into an int
| 0 | 656 |
output
|
struct.unpack('<L', 'y\xcc\xa6\xbb')[0]
| 1 | 656 |
instruction
|
get the first row, second column; second row, first column, and first row third column values of numpy array `arr`
| 0 | 657 |
output
|
arr[[0, 1, 1], [1, 0, 2]]
| 1 | 657 |
instruction
|
create a list with permutations of string 'abcd'
| 0 | 658 |
output
|
list(powerset('abcd'))
| 1 | 658 |
instruction
|
Convert string to boolean from defined set of strings
| 0 | 659 |
output
|
s in ['true', '1', 't', 'y', 'yes', 'yeah', 'yup', 'certainly', 'uh-huh']
| 1 | 659 |
instruction
|
replace special characters in url 'http://spam.com/go/' using the '%xx' escape
| 0 | 660 |
output
|
urllib.parse.quote('http://spam.com/go/')
| 1 | 660 |
instruction
|
Save plot `plt` as svg file 'test.svg'
| 0 | 661 |
output
|
plt.savefig('test.svg')
| 1 | 661 |
instruction
|
count the number of elements in array `myArray`
| 0 | 662 |
output
|
len(myArray)
| 1 | 662 |
instruction
|
insert directory './path/to/your/modules/' to current directory
| 0 | 663 |
output
|
sys.path.insert(0, './path/to/your/modules/')
| 1 | 663 |
instruction
| null | 0 | 664 |
output
|
ax.xaxis.set_ticks_position('top')
| 1 | 664 |
instruction
|
Insert records in bulk from "table1" of "master" DB to "table1" of sqlite3 `cursor` object
| 0 | 665 |
output
|
cursor.execute('INSERT OR REPLACE INTO master.table1 SELECT * FROM table1')
| 1 | 665 |
instruction
|
Match regex '[a-zA-Z][\\w-]*\\Z' on string 'A\n'
| 0 | 666 |
output
|
re.match('[a-zA-Z][\\w-]*\\Z', 'A\n')
| 1 | 666 |
instruction
|
match regex '[a-zA-Z][\\w-]*$' on string '!A_B'
| 0 | 667 |
output
|
re.match('[a-zA-Z][\\w-]*$', '!A_B')
| 1 | 667 |
instruction
|
Convert hex string "deadbeef" to integer
| 0 | 668 |
output
|
int('deadbeef', 16)
| 1 | 668 |
instruction
|
Convert hex string "a" to integer
| 0 | 669 |
output
|
int('a', 16)
| 1 | 669 |
instruction
|
Convert hex string "0xa" to integer
| 0 | 670 |
output
|
int('0xa', 16)
| 1 | 670 |
instruction
|
Convert hex string `s` to integer
| 0 | 671 |
output
|
int(s, 16)
| 1 | 671 |
instruction
|
Convert hex string `hexString` to int
| 0 | 672 |
output
|
int(hexString, 16)
| 1 | 672 |
instruction
|
print variable `value ` without spaces
| 0 | 673 |
output
|
print('Value is "' + str(value) + '"')
| 1 | 673 |
instruction
|
Print a string `value` with string formatting
| 0 | 674 |
output
|
print('Value is "{}"'.format(value))
| 1 | 674 |
instruction
|
Jinja join elements of array `tags` with space string ' '
| 0 | 675 |
output
|
{{tags | join(' ')}}
| 1 | 675 |
instruction
|
get a list of locally installed Python modules
| 0 | 676 |
output
|
help('modules')
| 1 | 676 |
instruction
|
Get only first element in each of the innermost of the multidimensional list `listD`
| 0 | 677 |
output
|
[[[x[0]] for x in listD[i]] for i in range(len(listD))]
| 1 | 677 |
instruction
|
Sort a string `s` in lexicographic order
| 0 | 678 |
output
|
sorted(s, key=str.upper)
| 1 | 678 |
instruction
|
sort string `s` in lexicographic order
| 0 | 679 |
output
|
sorted(sorted(s), key=str.upper)
| 1 | 679 |
instruction
|
get a sorted list of the characters of string `s` in lexicographic order, with lowercase letters first
| 0 | 680 |
output
|
sorted(s, key=str.lower)
| 1 | 680 |
instruction
|
find all the rows in Dataframe 'df2' that are also present in Dataframe 'df1', for the columns 'A', 'B', 'C' and 'D'.
| 0 | 681 |
output
|
pd.merge(df1, df2, on=['A', 'B', 'C', 'D'], how='inner')
| 1 | 681 |
instruction
|
Reverse key-value pairs in a dictionary `map`
| 0 | 682 |
output
|
dict((v, k) for k, v in map.items())
| 1 | 682 |
instruction
|
decode unicode string `s` into a readable unicode literal
| 0 | 683 |
output
|
s.decode('unicode_escape')
| 1 | 683 |
instruction
|
convert list of strings `str_list` into list of integers
| 0 | 684 |
output
|
[int(i) for i in str_list]
| 1 | 684 |
instruction
|
convert a list with string `['1', '2', '3']` into list with integers
| 0 | 685 |
output
|
map(int, ['1', '2', '3'])
| 1 | 685 |
instruction
|
convert list with str into list with int
| 0 | 686 |
output
|
list(map(int, ['1', '2', '3']))
| 1 | 686 |
instruction
|
find all anchor tags in html `soup` whose url begins with `http://www.iwashere.com`
| 0 | 687 |
output
|
soup.find_all('a', href=re.compile('http://www\\.iwashere\\.com/'))
| 1 | 687 |
instruction
|
find all anchors with a hyperlink that matches the pattern '^(?!(?:[a-zA-Z][a-zA-Z0-9+.-]*:|//))'
| 0 | 688 |
output
|
soup.find_all('a', href=re.compile('^(?!(?:[a-zA-Z][a-zA-Z0-9+.-]*:|//))'))
| 1 | 688 |
instruction
|
execute a jar file 'Blender.jar' using subprocess
| 0 | 689 |
output
|
subprocess.call(['java', '-jar', 'Blender.jar'])
| 1 | 689 |
instruction
|
insert row into mysql database with column 'column1' set to the value `value`
| 0 | 690 |
output
|
cursor.execute('INSERT INTO table (`column1`) VALUES (%s)', (value,))
| 1 | 690 |
instruction
|
remove a substring ".com" from the end of string `url`
| 0 | 691 |
output
|
if url.endswith('.com'):
url = url[:(-4)]
| 1 | 691 |
instruction
|
remove a substring ".com" from the end of string `url`
| 0 | 692 |
output
|
url = re.sub('\\.com$', '', url)
| 1 | 692 |
instruction
|
remove a substring ".com" from the end of string `url`
| 0 | 693 |
output
|
print(url.replace('.com', ''))
| 1 | 693 |
instruction
|
remove a substring `suffix` from the end of string `text`
| 0 | 694 |
output
|
if (not text.endswith(suffix)):
return text
return text[:(len(text) - len(suffix))]
| 1 | 694 |
instruction
|
print each first value from a list of tuples `mytuple` with string formatting
| 0 | 695 |
output
|
print(', ,'.join([str(i[0]) for i in mytuple]))
| 1 | 695 |
instruction
|
clamping floating number `my_value` to be between `min_value` and `max_value`
| 0 | 696 |
output
|
max(min(my_value, max_value), min_value)
| 1 | 696 |
instruction
|
split a unicode string `text` into a list of words and punctuation characters with a regex
| 0 | 697 |
output
|
re.findall('\\w+|[^\\w\\s]', text, re.UNICODE)
| 1 | 697 |
instruction
|
execute raw sql queue '<sql here>' in database `db` in sqlalchemy-flask app
| 0 | 698 |
output
|
result = db.engine.execute('<sql here>')
| 1 | 698 |
instruction
|
quit program
| 0 | 699 |
output
|
sys.exit(0)
| 1 | 699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.