This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34.62365962451697 | 78.0246928153624 | 0 | |
---|---|---|---|
30.28671076822607 | 43.89499752400101 | 0 | |
35.84740876993872 | 72.90219802708364 | 0 | |
60.18259938620976 | 86.30855209546826 | 1 | |
79.0327360507101 | 75.3443764369103 | 1 | |
45.08327747668339 | 56.3163717815305 | 0 | |
61.10666453684766 | 96.51142588489624 | 1 | |
75.02474556738889 | 46.55401354116538 | 1 | |
76.09878670226257 | 87.42056971926803 | 1 | |
84.43281996120035 | 43.53339331072109 | 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import pandas as pd | |
import requests | |
data_url = "https://gist.githubusercontent.com/noamross/e5d3e859aa0c794be10b/raw/cars.csv" | |
data_string = requests.get(data_url).text | |
df = pd.read_csv(io.StringIO(data_string), index_col=0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
HELLO_WORLD_DEFAULT = os.environ.get( | |
"HELLO_WORLD_DEFAULT", | |
default="World" | |
) | |
def hello(world: str = HELLO_WORLD_DEFAULT) -> str: | |
return f"Hello, {world}!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pycosnippets run-gist \ | |
--user rhdzmota \ | |
--file hello-world.py \ | |
--gist-id 42bcb9e078cae8694f1240808232a2ac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Challenge: implement swapcase without using the built-in method | |
def swapcase(string: str) -> str: | |
return "".join( | |
char.lower() if char.isupper() else char.upper() | |
for char in string | |
) | |
assert swapcase("AbCd") == "aBcD" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalene \ | |
--profile-all \ | |
--reduced-profile \ | |
--cpu-percent-threshold 1 \ | |
my_script.py | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pycodestyle . --max-line-length=120 --exclude venv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Python Style | |
on: [pull_request] | |
jobs: | |
build: | |
name: Style Check | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: clone-repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List, Tuple, Optional | |
RETURN_TYPE = Optional[Tuple[List[int], List[int]]] | |
def bisect(my_list: List[int], max_val: int) -> RETURN_TYPE: | |
partial_sum = 0 | |
for i, val in enumerate(my_list): | |
partial_sum += val | |
if partial_sum > max_val: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import json | |
from typing import Dict, TypeVar | |
SerializableDataType = TypeVar( | |
"SerializableDataType", | |
bound="Serializable" | |
) |