Skip to content

Commit

Permalink
Use poetry to handle dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMimic committed Sep 4, 2024
1 parent e02bc64 commit 3979866
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 19 deletions.
26 changes: 12 additions & 14 deletions 03_Programming/15_reading-csv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/python3


""" Example 1 """

# Import
import pandas

# Open file
data = pandas.read_csv("15_csv-example.csv", delimiter="\t")
# Print data
for index, row in data.iterrows():
print(f"{row['Name']}'s color is {row['Color']}")

""" Exemple 2 """

# Import
import csv

Expand All @@ -12,16 +23,3 @@
# Parse every row to print it
for row in read_csv_file:
print("'s color is ".join(row))


""" Exemple 2 """
# Import
import re

# Open file
csv_file = open("15_csv-example.csv", "r", encoding="utf-8")
for row in csv_file:
# Get values with regex
row_data = re.findall("(.*)\t(.*)", str(row))
# And print
print("{}'s color is {}".format(row_data[0][0], row_data[0][1]))
6 changes: 1 addition & 5 deletions 04_Machine-Learning/22_perceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ def train_weights(self):
self.bias = self.bias + self.l_rate * error
for i in range(len(row) - 1):
weights[i] = weights[i] + self.l_rate * error * row[i]
print(
"epoch: {}, lrate: {}, errors: {}".format(
epoch, self.l_rate, epoch_errors
)
)
print(f"epoch: {epoch}, lrate: {self.l_rate}, errors: {epoch_errors}")

plt.plot(global_errors)
plt.ylim(-1, 2)
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ Jobs linked to __data science__ are becoming __more and more popular__. A __bunc

For the moment, a lot is __got on wikipedia or generated by LLMs__ (except for codes, always handmade). Any help's thus welcome!

## Run the examples

Install Poetry

```bash
curl -sSL https://install.python-poetry.org | python3 -
```

Install dependencies

```bash
poetry install
```


## Rules

* __Feel free to fork this repository and pull requests__.
Expand Down
148 changes: 148 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
package-mode = false
description = "Some tutorial coming with the data science roadmap."
authors = ["Emeric <emeric.dynomant@gmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"


[tool.poetry.group.dev.dependencies]
black = "^24.8.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 3979866

Please sign in to comment.