question_id
int64
1.48k
42.8M
jpn_intent
stringlengths
3
188
snippet
stringlengths
2
232
19,863,964
矢量 "vf"フィールドの大きさ (長さ) の平方を求め
np.einsum('...j,...j->...', vf, vf)
4,476,373
Python で http url を要求する
r = requests.get(url)
4,476,373
Pythonで,ペイロードのパラメータを持つ http url 'url' を要求する
r = requests.get(url, params=payload)
4,476,373
Python で,ペイロードのパラメータを持つ"url"を入力する
r = requests.post(url, data=payload)
4,476,373
Python で,データ"post_data"で http 投稿要求を作成する
post_response = requests.post(url='http://httpbin.org/post', json=post_data)
23,422,542
ダイアンゴ・ジンジャスライスリスト"ミリスト"は"3:8"で,パイソン語
{{(mylist | slice): '3:8'}}
14,591,855
Python で"firstset"キーで"/home/.../data.h5" hdf ストアファイルの内容を入力して"df"データフレームを作成する
df1 = pd.read_hdf('/home/.../data.h5', 'firstSet')
31,950,612
Python で test_string の文字列で文字"([{"が最後に発生した最大値のインデックスを取得
max(test_string.rfind(i) for i in '([{')
10,569,438
Python で"u2713"と入力する
print('here is your checkmark: ' + '\u2713')
10,569,438
Python で "\u0420\u043e\u0441\u0441\u0438\u044f" の文字列にユニコード文字を印刷する
print('\u0420\u043e\u0441\u0441\u0438\u044f')
3,505,831
テープの文字列"5"は左側で 1 0
print('{0}'.format('5'.zfill(2)))
7,458,689
リストの"シーケンス"から重複要素を削除し,上昇順で整理する
sorted(set(itertools.chain.from_iterable(sequences)))
23,748,995
パンダデータフレーム "df"列 "a" をリストに
df['a'].values.tolist()
23,748,995
パイthon で,パンドデータフレーム 'df' の列 'a' のすべての値のリストを取得
df['a'].tolist()
6,275,762
文字列の引用を逃す
replace('"', '\\"')
3,668,964
リストの"単語"の文字列要素がすべて上方にあるかどうかを確認する
print(all(word[0].isupper() for word in words))
29,218,750
項目の値"val"が42である場合,辞書"mydict"から項目を削除する
myDict = {key: val for key, val in list(myDict.items()) if val != 42}
29,218,750
Pythonで"mydict"の値が"42"である辞書からすべての項目を削除する
{key: val for key, val in list(myDict.items()) if val != 42}
6,714,826
Python で utf-8 暗号化された文字列のバイト長さを決定する
return len(s.encode('utf-8'))
1,064,335
Python で,process.pid id でプロセスを実行する
os.kill(process.pid, signal.SIGKILL)
14,247,586
Python で,データフレーム 'df' で null 値を持つ列のデータを取得
df[pd.isnull(df).any(axis=1)]
41,133,414
文字列から"&"を削除し,残る文字列から"="を削除し,最後に ".html"を連結する
url.split('&')[-1].replace('=', '') + '.html'
1,179,305
Python 3 でExpat パースを使用してファイル"sample.xml"を解析する
parser.ParseFile(open('sample.xml', 'rb'))
3,376,534
出口脚本
sys.exit()
19,153,328
Pythonで,クラス属性 "attr" に"グループ"の値を動的に割り当て
setattr(self, attr, group)
28,431,359
文字の相当数にURLコードされた文字列"some_string"を解読する
urllib.parse.unquote(urllib.parse.unquote(some_string))
28,431,359
Python で,二重URLコード文字列"fireshot3%2b%25282%2529.png"を"fireshot3+(2).png"に解読する
urllib.parse.unquote(urllib.parse.unquote('FireShot3%2B%25282%2529.png'))
14,793,098
Python で,ボトルセキュリティレジスタのURLを"/create_account"に変更する
app.config['SECURITY_REGISTER_URL'] = '/create_account'
5,285,181
バイナリ書き込みモードでファイル"/home/user/test/wsservice/data.pkl"を開く
output = open('/home/user/test/wsservice/data.pkl', 'wb')
627,435
Python でリスト "a" の最後の要素を削除する
del a[(-1)]
627,435
リスト"a"の要素をインデックス1で削除する
a.pop(1)
627,435
Python でリスト "a" の最後の要素を削除する
a.pop()
627,435
Pythonで"index"でリスト "a"の要素を削除する
a.pop(index)
627,435
Pythonで"index"でリスト "a"の要素を削除する
del a[index]
8,440,117
パイthonで図形"軸"のx軸にセルシウスのシンボルを印刷する
ax.set_xlabel('Temperature (\u2103)')
8,440,117
テープ・プロットリブでセルシウスのシンボルを印刷する
ax.set_xlabel('Temperature ($^\\circ$C)')
18,022,241
Python で空きサブリストを空き文字列 '' として保持する文字列のリストにリストのリストを変換する
[''.join(l) for l in list_of_lists]
14,657,241
パンダを使用してデータフレーム 'df' のすべての重複項目の一覧を取得
pd.concat(g for _, g in df.groupby('ID') if len(g) > 1)
3,877,491
Pythonで,numpy array 'x' の第3行を削除する
x = numpy.delete(x, 2, axis=1)
3,877,491
Python で,アレイの第1行を削除する
x = numpy.delete(x, 0, axis=0)
19,490,064
データのフレーム"df1"から"df2"からの行を合併し,軸1と同じ値を持つ行の平均を計算する
pd.concat((df1, df2), axis=1).mean(axis=1)
18,461,623
Python で,numpy の2 つのアレイから平均値を取得する
np.mean(np.array([old_set, new_set]), axis=0)
19,948,732
マットプロットリブ マーカーのサイズを500に変更する
scatter(x, y, s=500, color='green', marker='h')
12,808,420
パイthonでリストの"単語"に各項目を分割することで新しいリスト"結果"を作成します
result = [item for word in words for item in word.split(',')]
10,805,589
Python で,json 文字列 '2012-05-29t19:30:03.283z' を"%y-%m-%dt%h:%m:%s.%fz"形式を使用してデータタイムオブジェクトに変換する
datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ')
35,561,743
Python で"tadas"辞書で"one"キーに関連した"true"値を数え
sum(item['one'] for item in list(tadas.values()))
208,894
ファイル"pdf_reference.pdf"を"base64"をコードする pdfファイルにエンコードする
a = open('pdf_reference.pdf', 'rb').read().encode('base64')
2,094,176
切り離しとして新行文字"\n"を使用した分割文字列"a"
a.rstrip().split('\n')
2,094,176
新しい行文字で文字列 "a" を分割する
a.split('\n')[:-1]
12,476,452
django ビューから HTTP 状態コード204 を返します
return HttpResponse(status=204)
7,571,635
Pythonで7が a で表示されているか確認する
(7 in a)
7,571,635
Pythonでリスト "a" に "a" が含まれているかどうかを確認する
('a' in a)
13,438,574
Pythonで"年"のキー値によって"結果"を分類するリスト
sorted(results, key=itemgetter('year'))
15,985,339
セルニウム Webdriver 'ブラウザ', Python で現在のURL を取得する
print(browser.current_url)
4,998,629
Pythonで"str"を"delimiter"または"delimiter"で分割する
re.split('; |, ', str)
5,555,063
Python の文字列で脱出する文字
"""\\u003Cp\\u003E""".decode('unicode-escape')
9,637,838
格式パターンの日付文字列 's' を"%d/%m/%y"にタイムスタンプに変換する
time.mktime(datetime.datetime.strptime(s, '%d/%m/%Y').timetuple())
9,637,838
"01/12/2011"の文字列を整数タイムスタンプに変換する
int(datetime.datetime.strptime('01/12/2011', '%d/%m/%Y').strftime('%s'))
29,386,995
ボトルで"あなたのヘッダー名"キーの http ヘッダーを取得する
request.headers['your-header-name']
27,868,020
資料フレーム "df" の記録を選択する.
df.groupby('User')['X'].filter(lambda x: x.sum() == 0)
27,868,020
資料フレーム"df"のデータを取得する.
df.loc[df.groupby('User')['X'].transform(sum) == 0]
27,868,020
列 "x" が 0 に等しいデータフレーム "df" からデータを取得する
df.groupby('User')['X'].transform(sum) == 0
12,323,403
セレニウムウェブドライバ (python) で特定のテキストを含む要素をどうやって見つけますか?
driver.find_elements_by_xpath("//*[contains(text(), 'My Button')]")
14,301,913
パイthon で,インデックスされたデータフレームに,インデックスされたデータフレームに,パンダグループをオブジェクトに変換する.
df.set_index(['Name', 'Destination'])
2,813,829
Python で文字列 "a" で文字以外の文字を集める
print(re.sub('(\\W)\\1+', '\\1', a))
1,679,798
ユニックスでファイル"$ファイル"を開く
os.system('start "$file"')
1,207,457
Unicode 文字列 "タイトル" を "ascii" 文字列に変換する
unicodedata.normalize('NFKD', title).encode('ascii', 'ignore')
1,207,457
Unicode 文字列 "a" を "ascii" 文字列に変換する
a.encode('ascii', 'ignore')
2,225,564
Python で 0 から 9 の間の数字から始まり,拡張子 ".jpg" で終わる"ファイル"をすべて含むリストを作成します.
files = [f for f in os.listdir('.') if re.match('[0-9]+.*\\.jpg', f)]
32,283,692
Python で 1D アレイ"[1, 2, 3, 4, 5, 6, 7, 8, 9]"を 3D アレイ"np.zeros((6, 9, 20)) に追加する
np.zeros((6, 9, 20)) + np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])[(None), :, (None)]
32,283,692
Python で,配列"[1, 2, 3, 4, 5, 6, 7, 8, 9]" に形状の配列" ((6, 9, 20) "を追加する
np.zeros((6, 9, 20)) + np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]).reshape((1, 9, 1))
247,724
Python を使用してアプリケーションのインスタンスを起動するには?
os.system('start excel.exe <path/to/file>')
29,760,130
リストのxで最高値を持つリストを Python で取得する
print(max(x, key=sum))
35,707,224
リスト"x"のリストの長さを合計する
sum(len(y) for y in x if len(y) > 1)
42,364,992
Pythonで"これは1号,これは22号"という文字列の引用に数字を入れます
re.sub('(\\d+)', '"\\1"', 'This is number 1 and this is number 22')
13,163,145
素数列の列を数列 "a" で掛け,結果となる数列列を数列 "a" で掛け, Python
numpy.dot(numpy.dot(a, m), a)
9,561,243
Django は Python の "エントリー" モデルで"名前" と"タイトル" と等しい基準"名前" と"タイトル" の基準が存在しているかどうかを確認します
Entry.objects.filter(name='name', title='title').exists()
34,705,205
巣のリストを要素2の逆で並べて,その後要素1に並べます
sorted(l, key=lambda x: (-int(x[1]), x[0]))
29,945,684
django でのリクエストオブジェクトからドメイン/ホスト名を取得
request.META['HTTP_HOST']
29,703,793
文字列の2つのサブ文字列間の"pi("randomkey123xyz987","key","text") の間の文字列をregexで取得する
re.findall("api\\('(.*?)'", "api('randomkey123xyz987', 'key', 'text')")
4,682,088
perl インターペーター '/usr/bin/perl' を使って perl 脚本 './uireplace.pl' を呼び出し,その上に 'var' を送信する
subprocess.call(['/usr/bin/perl', './uireplace.pl', var])
15,769,246
Python で "mylist"項目の印刷リスト
print('\n'.join(str(p) for p in myList))
13,860,026
Python で,ダイナミックキー"i"とキー"name"で値を更新する
mydic.update({i: o['name']})
18,711,384
"utf-8"コードされた文字列 "stru" を文字列に分割する
list(stru.decode('utf-8'))
8,898,294
Python で,bom string 's' を utf-8 に,bom 'u' をなし utf-8 に変換する
u = s.decode('utf-8-sig')
687,295
フィルターモデル"入力"で"id"は django で 3 に等しいでない
Entry.objects.filter(~Q(id=3))
2,850,966
Pythonで"範囲"という名前で任意の範囲で属性検索
getattr(__builtins__, 'range')
14,764,126
副プロセスの使用で"900"秒後にコンピュータを再起動する
subprocess.call(['shutdown', '/r', '/t', '900'])
14,764,126
副プロセスを使用してコンピュータをシャットダウンする
subprocess.call(['shutdown', '/s'])
14,764,126
副プロセスを使用してコンピュータのシャットダウンを中止する
subprocess.call(['shutdown', '/a '])
14,764,126
Python を使用するウィンドウオペレーティング システムを持つログオフコンピュータ
subprocess.call(['shutdown', '/l '])
14,764,126
スクリプトから実行するウィンドウをシャットダウンして再起動する
subprocess.call(['shutdown', '/r'])
2,769,061
Python でファイル名 の内容を削除する
open('filename', 'w').close()
2,769,061
Python でテキストファイルのファイル内容を削除するには?
open('file.txt', 'w').close()
29,815,129
索引値を含む辞書リストにデータフレーム "df" を変換する
df.to_dict('index')
29,815,129
パイthon で パンダデータフレーム 'df' から辞書リストを作成する
df.to_dict('records')
24,082,784
グループバイを使用して月間周波数 "m" に関するパンドデータフレームをグループ
df.groupby(pd.TimeGrouper(freq='M'))
3,731,426
Python で,他のリストの"試行"の対応メンバーに"変換"のリストのメンバーを分割する
[(c / t) for c, t in zip(conversions, trials)]
16,772,071
値によって"データ"を整理する
sorted(data, key=data.get)
16,772,071
辞書"データ"をその値によって分類する
sorted(data.values())