diff --git a/notebooks/componentization/claude.md b/notebooks/componentization/claude.md new file mode 100644 index 00000000..722a7f90 --- /dev/null +++ b/notebooks/componentization/claude.md @@ -0,0 +1,82 @@ +# Conversas com Claude.ai - Componentization + +## Passo 1 - Módulo / Pacote + +Consider the following code: + + +``` +import pandas as pd +import matplotlib.pyplot as plt + +df = pd.read_csv('intake-person-demo(potato-chips).csv') + +plt.figure(figsize=(10, 6)) +scatter = plt.scatter(df['age'], df['intake_bw'], c=df['intake_bw'], cmap='viridis') + +plt.xlabel('age') +plt.ylabel('intake_bw') +plt.title('Age vs. Intake (body weight)') + +plt.colorbar(scatter, label='intake_bw') + +plt.show() +``` + +How can I reorganize this code in two functions (table and scatter_plot) and a main code that call them? +* table: receives the path as parameter and reads the CSV, returning the data +* scatter_plot: receives the data, xfield, yfield, and title, ploting the scatter plot +xfield and yfield are both the name of the field in the CSV and its label. + +