Skip to content

Commit

Permalink
Fix Pandas SettingWithCopyWarning by using loc
Browse files Browse the repository at this point in the history
Signed-off-by: Alain Anghelidi <alainanghelidi@gmail.com>
  • Loading branch information
aanghelidi committed Oct 28, 2023
1 parent 5d24570 commit b790049
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion demo-project/src/demo_project/pipelines/reporting/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def make_price_histogram(model_input_data: pd.DataFrame) -> go.Figure:
Returns:
BaseFigure: Plotly object which is serialised as JSON for rendering
"""
price_data_df = model_input_data[["price", "engine_type"]]
price_data_df = model_input_data.loc[:, ["price", "engine_type"]]
p = np.random.dirichlet([1, 1, 1])
price_data_df["engine_type"] = np.random.choice(
["Quantum", "Plasma", "Nuclear"], len(price_data_df), p=p
Expand Down

0 comments on commit b790049

Please sign in to comment.