source stringclasses 3
values | url stringlengths 39 130 | language stringclasses 2
values | title stringlengths 5 629 | original_code stringlengths 52 30.8k | cleaned_code stringlengths 52 10k | quality_score int64 6 8 | is_valid bool 1
class | issues_found stringclasses 2
values | scraped_at stringdate 2025-11-13 07:35:03 2025-11-13 07:35:52 | tags stringclasses 8
values |
|---|---|---|---|---|---|---|---|---|---|---|
duckduckgo | https://realpython.com/async-io-python/ | unknown | Python's asyncio: A Hands-On Walkthrough - Real Python | import time
def count():
print("One")
time.sleep(1)
print("Two")
time.sleep(1)
def main():
for _ in range(3):
count()
if __name__ == "__main__":
start = time.perf_counter()
main()
elapsed = time.perf_counter() - start
print(f"{__file__} executed in {elapsed:0.2f} seconds."... | import time
def count():
print("One")
time.sleep(1)
print("Two")
time.sleep(1)
def main():
for _ in range(3):
count()
if __name__ == "__main__":
start = time.perf_counter()
main()
elapsed = time.perf_counter() - start
print(f"{__file__} executed in {elapsed:0.2f} seconds."... | 8 | true | [] | 2025-11-13T07:35:03.839196 | [] |
duckduckgo | https://realpython.com/async-io-python/ | unknown | Python's asyncio: A Hands-On Walkthrough - Real Python | $ python countsync.py
One
Two
One
Two
One
Two
countsync.py executed in 6.03 seconds.
| $ python countsync.py
One
Two
One
Two
One
Two
countsync.py executed in 6.03 seconds.
| 6 | true | [] | 2025-11-13T07:35:03.839208 | [] |
duckduckgo | https://stackoverflow.com/questions/50757497/simplest-async-await-example-possible-in-python | unknown | Simplest async/await example possible in Python | import asyncio
async def async_foo():
print("async_foo started")
await asyncio.sleep(5)
print("async_foo done")
async def main():
asyncio.ensure_future(async_foo()) # fire and forget async_foo()
print('Do some actions 1')
await asyncio.sleep(5)
print('Do some actions 2')
loop = asyncio.g... | import asyncio
async def async_foo():
print("async_foo started")
await asyncio.sleep(5)
print("async_foo done")
async def main():
asyncio.ensure_future(async_foo()) # fire and forget async_foo()
print('Do some actions 1')
await asyncio.sleep(5)
print('Do some actions 2')
loop = asyncio.g... | 8 | true | [] | 2025-11-13T07:35:06.317723 | [] |
duckduckgo | https://stackoverflow.com/questions/50757497/simplest-async-await-example-possible-in-python | unknown | Simplest async/await example possible in Python | import time
def sleep():
print(f'Time: {time.time() - start:.2f}')
time.sleep(1)
def sum_(name, numbers):
total = 0
for number in numbers:
print(f'Task {name}: Computing {total}+{number}')
sleep()
total += number
print(f'Task {name}: Sum = {total}\n')
start = time.time()
t... | import time
def sleep():
print(f'Time: {time.time() - start:.2f}')
time.sleep(1)
def sum_(name, numbers):
total = 0
for number in numbers:
print(f'Task {name}: Computing {total}+{number}')
sleep()
total += number
print(f'Task {name}: Sum = {total}\n')
start = time.time()
t... | 8 | true | [] | 2025-11-13T07:35:06.317737 | [] |
duckduckgo | https://www.geeksforgeeks.org/python/asyncio-in-python/ | unknown | asyncio in Python - GeeksforGeeks | import asyncio
async def fn():
print('This is ')
await asyncio.sleep(1)
print('asynchronous programming')
await asyncio.sleep(1)
print('and not multi-threading')
asyncio.run(fn())
| import asyncio
async def fn():
print('This is ')
await asyncio.sleep(1)
print('asynchronous programming')
await asyncio.sleep(1)
print('and not multi-threading')
asyncio.run(fn())
| 8 | true | [] | 2025-11-13T07:35:09.354337 | [] |
duckduckgo | https://www.geeksforgeeks.org/python/asyncio-in-python/ | unknown | asyncio in Python - GeeksforGeeks | import asyncio
async def fn():
print("one")
await asyncio.sleep(1)
await fn2()
print('four')
await asyncio.sleep(1)
print('five')
await asyncio.sleep(1)
async def fn2():
await asyncio.sleep(1)
print("two")
await asyncio.sleep(1)
print("three")
asyncio.run(fn())
| import asyncio
async def fn():
print("one")
await asyncio.sleep(1)
await fn2()
print('four')
await asyncio.sleep(1)
print('five')
await asyncio.sleep(1)
async def fn2():
await asyncio.sleep(1)
print("two")
await asyncio.sleep(1)
print("three")
asyncio.run(fn())
| 8 | true | [] | 2025-11-13T07:35:09.354350 | [] |
github | https://github.com/PunyGoood/syn_data_concept/blob/381934a2f01d710790fcb1efce416bc0297cf729/syn.py | python | syn.py | import asyncio
import json
import os
import random
import time
from dataclasses import dataclass, field
from typing import cast, Literal
from tqdm.auto import tqdm
from datasets import Dataset, load_dataset
from pathlib import Path
from transformers import HfArgumentParser
import re
import utils as utils
import aiohttp... | import asyncio
import json
import os
import random
import time
from dataclasses import dataclass, field
from typing import cast, Literal
from tqdm.auto import tqdm
from datasets import Dataset, load_dataset
from pathlib import Path
from transformers import HfArgumentParser
import re
import utils as utils
import aiohttp... | 8 | true | ["Code truncated to 10k chars"] | 2025-11-13T07:35:12.735930 | [] |
github | https://github.com/Rig14/http-torrent/blob/c5badbb1cdf83d6e903fb1edd17ad36531e31569/dht.py | python | dht.py | import asyncio
import json
import logging
import pickle
import base64
import socket
from typing import Any, Dict, Optional, Tuple, Union, List
from kademlia.network import Server
class KademliaDHT:
"""
A wrapper around Kademlia DHT that supports storing and retrieving complex Python objects.
"""
def ... | import asyncio
import json
import logging
import pickle
import base64
import socket
from typing import Any, Dict, Optional, Tuple, Union, List
from kademlia.network import Server
class KademliaDHT:
"""
A wrapper around Kademlia DHT that supports storing and retrieving complex Python objects.
"""
def ... | 8 | true | [] | 2025-11-13T07:35:14.598441 | [] |
github | https://github.com/ashfordhill/AI-design-theater/blob/f42ba7947f16a21601ea08485699afef248ac94c/cli.py | python | cli.py | """Command-line interface for AI Design Theater."""
import asyncio
import os
import typer
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.progress import Progress, SpinnerColumn, TextColumn
from typing import Optional
from pathlib import Path
from src.main import A... | """Command-line interface for AI Design Theater."""
import asyncio
import os
import typer
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.progress import Progress, SpinnerColumn, TextColumn
from typing import Optional
from pathlib import Path
from src.main import A... | 8 | true | ["Code truncated to 10k chars"] | 2025-11-13T07:35:16.214453 | [] |
stackoverflow | https://stackoverflow.com/questions/34753401/difference-between-coroutine-and-future-task-in-python-3-5 | python | Difference between coroutine and future/task in Python 3.5? | async def foo(arg):
result = await some_remote_call(arg)
return result.upper()
| async def foo(arg):
result = await some_remote_call(arg)
return result.upper()
| 8 | true | [] | 2025-11-13T07:35:18.515256 | ["python", "python-3.x", "python-asyncio"] |
stackoverflow | https://stackoverflow.com/questions/34753401/difference-between-coroutine-and-future-task-in-python-3-5 | python | Difference between coroutine and future/task in Python 3.5? | import asyncio
coros = []
for i in range(5):
coros.append(foo(i))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(coros))
| import asyncio
coros = []
for i in range(5):
coros.append(foo(i))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(coros))
| 8 | true | [] | 2025-11-13T07:35:18.515287 | ["python", "python-3.x", "python-asyncio"] |
stackoverflow | https://stackoverflow.com/questions/34753401/difference-between-coroutine-and-future-task-in-python-3-5 | python | Difference between coroutine and future/task in Python 3.5? | import asyncio
futures = []
for i in range(5):
futures.append(asyncio.ensure_future(foo(i)))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(futures))
| import asyncio
futures = []
for i in range(5):
futures.append(asyncio.ensure_future(foo(i)))
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(futures))
| 8 | true | [] | 2025-11-13T07:35:18.515306 | ["python", "python-3.x", "python-asyncio"] |
stackoverflow | https://stackoverflow.com/questions/34753401/difference-between-coroutine-and-future-task-in-python-3-5 | python | Difference between coroutine and future/task in Python 3.5? | import asyncio
async def do_something_async():
tasks = []
for i in range(5):
tasks.append(asyncio.create_task(foo(i)))
await asyncio.gather(*tasks)
def do_something():
asyncio.run(do_something_async)
| import asyncio
async def do_something_async():
tasks = []
for i in range(5):
tasks.append(asyncio.create_task(foo(i)))
await asyncio.gather(*tasks)
def do_something():
asyncio.run(do_something_async)
| 8 | true | [] | 2025-11-13T07:35:18.515322 | ["python", "python-3.x", "python-asyncio"] |
stackoverflow | https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop | python | "Asyncio Event Loop is Closed" when getting loop | import asyncio
async def hello_world():
print("Hello World!")
loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()
| import asyncio
async def hello_world():
print("Hello World!")
loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()
| 8 | true | [] | 2025-11-13T07:35:19.866354 | ["python", "python-asyncio", "python-3.5"] |
stackoverflow | https://stackoverflow.com/questions/54441424/learning-asyncio-coroutine-was-never-awaited-warning-error | python | Learning asyncio: "coroutine was never awaited" warning error | import time
import datetime
import random
import asyncio
import aiohttp
import requests
def requete_bloquante(num):
print(f'Get {num}')
uid = requests.get("https://httpbin.org/uuid").json()['uuid']
print(f"Res {num}: {uid}")
def faire_toutes_les_requetes():
for x in range(10):
requete_bloqua... | import time
import datetime
import random
import asyncio
import aiohttp
import requests
def requete_bloquante(num):
print(f'Get {num}')
uid = requests.get("https://httpbin.org/uuid").json()['uuid']
print(f"Res {num}: {uid}")
def faire_toutes_les_requetes():
for x in range(10):
requete_bloqua... | 8 | true | [] | 2025-11-13T07:35:21.373412 | ["python", "python-asyncio", "aiohttp"] |
stackoverflow | https://stackoverflow.com/questions/54441424/learning-asyncio-coroutine-was-never-awaited-warning-error | python | Learning asyncio: "coroutine was never awaited" warning error | synchronicite.py:43: RuntimeWarning: coroutine 'faire_toutes_les_requetes_sans_bloquer' was never awaited
| synchronicite.py:43: RuntimeWarning: coroutine 'faire_toutes_les_requetes_sans_bloquer' was never awaited
| 6 | true | [] | 2025-11-13T07:35:21.373440 | ["python", "python-asyncio", "aiohttp"] |
duckduckgo | https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean | unknown | What does colon equal (:=) in Python mean? - Stack Overflow | node := root, cost = 0
frontier := priority queue containing node only
explored := empty set
| node := root, cost = 0
frontier := priority queue containing node only
explored := empty set
| 6 | true | [] | 2025-11-13T07:35:23.306266 | [] |
duckduckgo | https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean | unknown | What does colon equal (:=) in Python mean? - Stack Overflow | # Handle a matched regex
if (match := pattern.search(data)) is not None:
# Do something with match
# A loop that can't be trivially rewritten using 2-arg iter()
while chunk := file.read(8192):
process(chunk)
# Reuse a value that's expensive to compute
[y := f(x), y**2, y**3]
# Share a subexpression between a ... | # Handle a matched regex
if (match := pattern.search(data)) is not None:
# Do something with match
# A loop that can't be trivially rewritten using 2-arg iter()
while chunk := file.read(8192):
process(chunk)
# Reuse a value that's expensive to compute
[y := f(x), y**2, y**3]
# Share a subexpression between a ... | 6 | true | [] | 2025-11-13T07:35:23.306280 | [] |
duckduckgo | https://stackoverflow.com/questions/6392739/what-does-the-at-symbol-do-in-python | unknown | What does the "at" (@) symbol do in Python? - Stack Overflow | class Pizza(object):
def __init__(self):
self.toppings = []
def __call__(self, topping):
# When using '@instance_of_pizza' before a function definition
# the function gets passed onto 'topping'.
self.toppings.append(topping())
def __repr__(self):
return str(self.top... | class Pizza(object):
def __init__(self):
self.toppings = []
def __call__(self, topping):
# When using '@instance_of_pizza' before a function definition
# the function gets passed onto 'topping'.
self.toppings.append(topping())
def __repr__(self):
return str(self.top... | 8 | true | [] | 2025-11-13T07:35:25.033536 | [] |
duckduckgo | https://stackoverflow.com/questions/6392739/what-does-the-at-symbol-do-in-python | unknown | What does the "at" (@) symbol do in Python? - Stack Overflow | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
| from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
| 8 | true | [] | 2025-11-13T07:35:25.033555 | [] |
duckduckgo | https://stackoverflow.com/questions/3294889/iterating-over-dictionaries-using-for-loops | unknown | python - Iterating over dictionaries using 'for' loops - Stack Overflow | d = {'x': 1, 'y': 2, 'z': 3}
for key in d:
print(key, 'corresponds to', d[key])
| d = {'x': 1, 'y': 2, 'z': 3}
for key in d:
print(key, 'corresponds to', d[key])
| 6 | true | [] | 2025-11-13T07:35:27.139647 | [] |
duckduckgo | https://stackoverflow.com/questions/3294889/iterating-over-dictionaries-using-for-loops | unknown | python - Iterating over dictionaries using 'for' loops - Stack Overflow | for key in dict.iterkeys(): ...
for value in dict.itervalues(): ...
for key, value in dict.iteritems(): ...
| for key in dict.iterkeys(): ...
for value in dict.itervalues(): ...
for key, value in dict.iteritems(): ...
| 6 | true | [] | 2025-11-13T07:35:27.139665 | [] |
github | https://github.com/m-bastam/python_class/blob/0feffe95baf39df733cd3f73a93348291f936812/Web.py | python | Web.py | # import the request module from urllib library.
from urllib import request
# This one has handy tools for scraping a web page.
from bs4 import BeautifulSoup
# If you want to dump data to json file.
import json
# If you want to save to CSV.
import csv
# URL (address) of the desired page.
# sample_url = 'https://AlanS... | # import the request module from urllib library.
from urllib import request
# This one has handy tools for scraping a web page.
from bs4 import BeautifulSoup
# If you want to dump data to json file.
import json
# If you want to save to CSV.
import csv
# URL (address) of the desired page.
# sample_url = 'https://AlanS... | 8 | true | [] | 2025-11-13T07:35:30.635258 | [] |
github | https://github.com/MRamya-sri/Web-Scraping/blob/bdf67d8fde3f7ea075b450a880def746cacb2b99/web.py | python | web.py | #using the requests library to see a website's HTML
# using websites to scrape
from bs4 import BeautifulSoup
import requests
#in that website we will access the text "posted few days ago" text
html_text = requests.get('https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&sear... | #using the requests library to see a website's HTML
# using websites to scrape
from bs4 import BeautifulSoup
import requests
#in that website we will access the text "posted few days ago" text
html_text = requests.get('https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&sear... | 8 | true | [] | 2025-11-13T07:35:31.823761 | [] |
github | https://github.com/170h/project-01/blob/839ed053ce6a4ce2e3b6a2473381f6d144916dae/app.py | python | app.py | import requests
from bs4 import BeautifulSoup
from flask import Flask, render_template
app = Flask(__name__)
class Scraper:
def __init__(self, url):
self.url = url
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58... | import requests
from bs4 import BeautifulSoup
from flask import Flask, render_template
app = Flask(__name__)
class Scraper:
def __init__(self, url):
self.url = url
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58... | 8 | true | [] | 2025-11-13T07:35:33.512209 | [] |
stackoverflow | https://stackoverflow.com/questions/22726860/beautifulsoup-webscraping-find-all-finding-exact-match | python | BeautifulSoup webscraping find_all( ): finding exact match | <body>
<div class="product">Product 1</div>
<div class="product">Product 2</div>
<div class="product special">Product 3</div>
<div class="product special">Product 4</div>
</body>
| <body>
<div class="product">Product 1</div>
<div class="product">Product 2</div>
<div class="product special">Product 3</div>
<div class="product special">Product 4</div>
</body>
| 6 | true | [] | 2025-11-13T07:35:34.936593 | ["python", "html", "regex", "web-scraping", "beautifulsoup"] |
stackoverflow | https://stackoverflow.com/questions/22726860/beautifulsoup-webscraping-find-all-finding-exact-match | python | BeautifulSoup webscraping find_all( ): finding exact match | result = soup.find_all('div', {'class': 'product'})
| result = soup.find_all('div', {'class': 'product'})
| 6 | true | [] | 2025-11-13T07:35:34.936638 | ["python", "html", "regex", "web-scraping", "beautifulsoup"] |
stackoverflow | https://stackoverflow.com/questions/22726860/beautifulsoup-webscraping-find-all-finding-exact-match | python | BeautifulSoup webscraping find_all( ): finding exact match | from bs4 import BeautifulSoup
import re
text = """
<body>
<div class="product">Product 1</div>
<div class="product">Product 2</div>
<div class="product special">Product 3</div>
<div class="product special">Product 4</div>
</body>"""
soup = BeautifulSoup(text)
result = soup.findAll(attrs={'class': re.c... | from bs4 import BeautifulSoup
import re
text = """
<body>
<div class="product">Product 1</div>
<div class="product">Product 2</div>
<div class="product special">Product 3</div>
<div class="product special">Product 4</div>
</body>"""
soup = BeautifulSoup(text)
result = soup.findAll(attrs={'class': re.c... | 8 | true | [] | 2025-11-13T07:35:34.936672 | ["python", "html", "regex", "web-scraping", "beautifulsoup"] |
stackoverflow | https://stackoverflow.com/questions/22726860/beautifulsoup-webscraping-find-all-finding-exact-match | python | BeautifulSoup webscraping find_all( ): finding exact match | [<div class="product">Product 1</div>, <div class="product">Product 2</div>, <div class="product special">Product 3</div>, <div class="product special">Product 4</div>]
| [<div class="product">Product 1</div>, <div class="product">Product 2</div>, <div class="product special">Product 3</div>, <div class="product special">Product 4</div>]
| 6 | true | [] | 2025-11-13T07:35:34.936705 | ["python", "html", "regex", "web-scraping", "beautifulsoup"] |
stackoverflow | https://stackoverflow.com/questions/57262217/how-do-you-use-ec-presence-of-element-locatedby-id-mydynamicelement-excep | python | How do you use EC.presence_of_element_located((By.ID, "myDynamicElement")) except to specify class not ID | element = WebDriverWait(driver,100).until(EC.presence_of_element_located((By.ID, "tabla_evolucion")))
| element = WebDriverWait(driver,100).until(EC.presence_of_element_located((By.ID, "tabla_evolucion")))
| 6 | true | [] | 2025-11-13T07:35:38.400604 | ["python", "selenium", "selenium-webdriver", "webdriverwait", "expected-condition"] |
stackoverflow | https://stackoverflow.com/questions/57262217/how-do-you-use-ec-presence-of-element-locatedby-id-mydynamicelement-excep | python | How do you use EC.presence_of_element_located((By.ID, "myDynamicElement")) except to specify class not ID | element = WebDriverWait(driver,100).until(EC.presence_of_element_located((By.class, "ng-binding ng-scope")))
| element = WebDriverWait(driver,100).until(EC.presence_of_element_located((By.class, "ng-binding ng-scope")))
| 6 | true | [] | 2025-11-13T07:35:38.400647 | ["python", "selenium", "selenium-webdriver", "webdriverwait", "expected-condition"] |
stackoverflow | https://stackoverflow.com/questions/57262217/how-do-you-use-ec-presence-of-element-locatedby-id-mydynamicelement-excep | python | How do you use EC.presence_of_element_located((By.ID, "myDynamicElement")) except to specify class not ID | driver_path = 'C:/webDrivers/chromedriver.exe'
driver = webdriver.Chrome(executable_path=driver_path)
driver.header_overrides = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'}
url = "myurlthatIamscraping.com"
response = driver.... | driver_path = 'C:/webDrivers/chromedriver.exe'
driver = webdriver.Chrome(executable_path=driver_path)
driver.header_overrides = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'}
url = "myurlthatIamscraping.com"
response = driver.... | 6 | true | [] | 2025-11-13T07:35:38.400676 | ["python", "selenium", "selenium-webdriver", "webdriverwait", "expected-condition"] |
duckduckgo | https://scikit-learn.org/stable/auto_examples/index.html | unknown | Examples — scikit-learn 1.7.2 documentation | Download all examples in Python source code: auto_examples_python.zip | Download all examples in Python source code: auto_examples_python.zip | 6 | true | [] | 2025-11-13T07:35:41.121027 | [] |
duckduckgo | https://scikit-learn.org/stable/auto_examples/index.html | unknown | Examples — scikit-learn 1.7.2 documentation | Download all examples in Jupyter notebooks: auto_examples_jupyter.zip | Download all examples in Jupyter notebooks: auto_examples_jupyter.zip | 6 | true | [] | 2025-11-13T07:35:41.121041 | [] |
duckduckgo | https://www.datacamp.com/cheat-sheet/scikit-learn-cheat-sheet-python-machine-learning | unknown | Scikit-Learn Cheat Sheet: Python Machine Learning - DataCamp A Comprehensive Guide to Scikit-Learn: Machine Learning in ... Scikit-learn: A Beginner’s Guide to Machine Learning in Python Create a Machine Learning Pipeline with Python | Scikit-learn ... Create a Machine Learning Pipeline with Python | Scikit-learn Tutor... | from sklearn import neighbors, datasets, preprocessing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
iris = datasets.load_iris()
X, y = iris.data[:, :2], iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=33)
scaler = preprocessing.Standa... | from sklearn import neighbors, datasets, preprocessing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
iris = datasets.load_iris()
X, y = iris.data[:, :2], iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=33)
scaler = preprocessing.Standa... | 8 | true | [] | 2025-11-13T07:35:43.264268 | [] |
duckduckgo | https://www.datacamp.com/cheat-sheet/scikit-learn-cheat-sheet-python-machine-learning | unknown | Scikit-Learn Cheat Sheet: Python Machine Learning - DataCamp A Comprehensive Guide to Scikit-Learn: Machine Learning in ... Scikit-learn: A Beginner’s Guide to Machine Learning in Python Create a Machine Learning Pipeline with Python | Scikit-learn ... Create a Machine Learning Pipeline with Python | Scikit-learn Tutor... | import numpy as np
X = np.random.random((10,5))
y = np.array(['M','M','F','F','M','F','M','M','F','F','F'])
X[X < 0.7] = 0 | import numpy as np
X = np.random.random((10,5))
y = np.array(['M','M','F','F','M','F','M','M','F','F','F'])
X[X < 0.7] = 0 | 8 | true | [] | 2025-11-13T07:35:43.264282 | [] |
duckduckgo | https://medium.com/@sumit.kaul.87/a-comprehensive-guide-to-scikit-learn-machine-learning-in-python-with-code-examples-8e4670877d03 | unknown | A Comprehensive Guide to Scikit-Learn: Machine Learning in ... | from sklearn.preprocessing import StandardScalerimport numpy as np# Sample dataX = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])# Standardizing the featuresscaler = StandardScaler()X_scaled = scaler.fit_transform(X)print(X_scaled) | from sklearn.preprocessing import StandardScalerimport numpy as np# Sample dataX = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])# Standardizing the featuresscaler = StandardScaler()X_scaled = scaler.fit_transform(X)print(X_scaled) | 8 | true | [] | 2025-11-13T07:35:44.430493 | [] |
duckduckgo | https://medium.com/@sumit.kaul.87/a-comprehensive-guide-to-scikit-learn-machine-learning-in-python-with-code-examples-8e4670877d03 | unknown | A Comprehensive Guide to Scikit-Learn: Machine Learning in ... | from sklearn.preprocessing import OneHotEncoder# Sample dataX = np.array([['cat'], ['dog'], ['cat'], ['bird']])# One-hot encodingencoder = OneHotEncoder(sparse=False)X_encoded = encoder.fit_transform(X)print(X_encoded) | from sklearn.preprocessing import OneHotEncoder# Sample dataX = np.array([['cat'], ['dog'], ['cat'], ['bird']])# One-hot encodingencoder = OneHotEncoder(sparse=False)X_encoded = encoder.fit_transform(X)print(X_encoded) | 8 | true | [] | 2025-11-13T07:35:44.430512 | [] |
github | https://github.com/jgirlsdad/ml-research-portal/blob/b6fe24f1dd57550460db4abb400e7ec5fcc01248/app.py | python | app.py | # BACK END BACK END BACK END
import pandas as pd
import csv
import pymongo
from flask import Flask, render_template, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
cors = CORS(app)
import pandas as pd
import numpy as np
import math
import warnings
warnings.filterwarnings('ignore')
fr... | # BACK END BACK END BACK END
import pandas as pd
import csv
import pymongo
from flask import Flask, render_template, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
cors = CORS(app)
import pandas as pd
import numpy as np
import math
import warnings
warnings.filterwarnings('ignore')
fr... | 8 | true | ["Code truncated to 10k chars"] | 2025-11-13T07:35:47.873127 | [] |
github | https://github.com/hexiangnan/neural_factorization_machine/blob/ca2a5d11b929816aa44c6e470e795af144608507/FM.py | python | FM.py | '''
Tensorflow implementation of Factorization Machines (FM) as described in:
Xiangnan He, Tat-Seng Chua. Neural Factorization Machines for Sparse Predictive Analytics. In Proc. of SIGIR 2017.
Note that the original paper of FM is: Steffen Rendle. Factorization Machines. In Proc. of ICDM 2010.
@author:
Xiangnan He (... | '''
Tensorflow implementation of Factorization Machines (FM) as described in:
Xiangnan He, Tat-Seng Chua. Neural Factorization Machines for Sparse Predictive Analytics. In Proc. of SIGIR 2017.
Note that the original paper of FM is: Steffen Rendle. Factorization Machines. In Proc. of ICDM 2010.
@author:
Xiangnan He (... | 8 | true | ["Code truncated to 10k chars"] | 2025-11-13T07:35:49.524478 | [] |
github | https://github.com/causalNLP/corr2cause/blob/21d80350e27a6206f536cf90a09e95d9e856c761/code/finetune/als.py | python | als.py | import logging
import sys
import json
import pandas as pd
import numpy as np
from sklearn.metrics import classification_report
sys.path.append('../')
from utils import LoggerWritter
handler = logging.StreamHandler(sys.stdout)
log = logging.getLogger('analysis')
log.addHandler(handler)
log.setLevel(logging.INFO)
sys.s... | import logging
import sys
import json
import pandas as pd
import numpy as np
from sklearn.metrics import classification_report
sys.path.append('../')
from utils import LoggerWritter
handler = logging.StreamHandler(sys.stdout)
log = logging.getLogger('analysis')
log.addHandler(handler)
log.setLevel(logging.INFO)
sys.s... | 8 | true | ["Code truncated to 10k chars"] | 2025-11-13T07:35:50.749735 | [] |
stackoverflow | https://stackoverflow.com/questions/41899132/invalid-parameter-for-sklearn-estimator-pipeline | python | Invalid parameter for sklearn estimator pipeline | pipe = make_pipeline(TfidfVectorizer(), LogisticRegression())
param_grid = {"logisticregression_C": [0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer_ngram_range": [(1,1), (1,2), (1,3)]}
grid = GridSearchCV(pipe, param_grid, cv=5)
grid.fit(X_train, y_train)
print("Best cross-validation score: {:.2f}".format(grid.best_sc... | pipe = make_pipeline(TfidfVectorizer(), LogisticRegression())
param_grid = {"logisticregression_C": [0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer_ngram_range": [(1,1), (1,2), (1,3)]}
grid = GridSearchCV(pipe, param_grid, cv=5)
grid.fit(X_train, y_train)
print("Best cross-validation score: {:.2f}".format(grid.best_sc... | 6 | true | [] | 2025-11-13T07:35:52.351926 | ["python", "scikit-learn", "grid-search", "scikit-learn-pipeline"] |
stackoverflow | https://stackoverflow.com/questions/41899132/invalid-parameter-for-sklearn-estimator-pipeline | python | Invalid parameter for sklearn estimator pipeline | ValueError: Invalid parameter logisticregression_C for estimator Pipeline
| ValueError: Invalid parameter logisticregression_C for estimator Pipeline
| 6 | true | [] | 2025-11-13T07:35:52.351968 | ["python", "scikit-learn", "grid-search", "scikit-learn-pipeline"] |
stackoverflow | https://stackoverflow.com/questions/24812253/how-can-i-capture-return-value-with-python-timeit-module | python | How can I capture return value with Python timeit module? | def RandomForest(train_input, train_output):
clf = ensemble.RandomForestClassifier(n_estimators=10)
clf.fit(train_input, train_output)
return clf
| def RandomForest(train_input, train_output):
clf = ensemble.RandomForestClassifier(n_estimators=10)
clf.fit(train_input, train_output)
return clf
| 8 | true | [] | 2025-11-13T07:35:53.507589 | ["python", "python-2.7", "scikit-learn", "timeit"] |
stackoverflow | https://stackoverflow.com/questions/24812253/how-can-i-capture-return-value-with-python-timeit-module | python | How can I capture return value with Python timeit module? | t = Timer(lambda : RandomForest(trainX,trainy))
print t.timeit(number=1)
| t = Timer(lambda : RandomForest(trainX,trainy))
print t.timeit(number=1)
| 6 | true | [] | 2025-11-13T07:35:53.507619 | ["python", "python-2.7", "scikit-learn", "timeit"] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.