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
fig, ax = plt.subplots(1, 1, figsize=(18, 7)) | |
sns.lineplot(x=df.index, y="mem_percentage", hue="NAME", data=df, drawstyle="steps") | |
plt.legend(bbox_to_anchor=(1.01, 1), loc='upper left') | |
plt.ylabel("MEM [%]") | |
plt.title(f"Memory") | |
plt.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False) | |
plt.grid() | |
plt.show() |
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 re | |
def get_only_characters(string): | |
return re.sub('[^a-zA-Z]+', '', string) | |
def get_only_numbers(string): | |
return float(re.sub('[^\d\.]', '', string)) | |
def to_bit(value): | |
return int({ |
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
df = pd.concat( | |
[ | |
pd.read_csv(filename, delimiter=r"\s\s+", engine="python") | |
for filename | |
in raw_data_filenames | |
], | |
axis=0, | |
ignore_index=True, | |
) |
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 | |
from glob import glob | |
ROOT_PATH = os.path.abspath("..") | |
raw_data_filenames = glob(os.path.join(ROOT_PATH, "assets/*.csv")) | |
raw_data_filenames.sort() |
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
class Movie(TypedDict, total=False): | |
title: str | |
release_year: int | |
rating: Literal[1, 2, 3, 4, 5] | |
comments: list[str] | |
sequel: Optional[str] |
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 TypedDict, Literal | |
class Movie(TypedDict): | |
title: str | |
release_year: int | |
rating: Literal[1, 2, 3, 4, 5] | |
comments: list[str] | |
m_1: Movie = { | |
"title": "Star Wars: A New Hope", |
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
type Movie = { | |
title: string | |
releaseYear: number | |
rating: 1 | 2 | 3 | 4 | 5 | |
comments: string[] | |
sequel?: string | |
} | |
let m1: Movie = { | |
title: "Star Wars: A New Hope", |
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 Optional | |
class Person(): | |
_id_counter = 0 | |
def __init__(self, name: str, age: Optional[int]): | |
self._id = Person.get_id() | |
self.name = name | |
self.age = age or 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
class Person { | |
private static idCounter = 0 | |
readonly id!: number | |
name!: string | |
age!: number | |
constructor(name: string, age?: number) { | |
this.id = Person.getId() | |
this.name = name | |
this.age = age ?? 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
from typing import Optional | |
def optional_foo(bar: Optional[str]): | |
return bar or "No input" |
NewerOlder