Skip to content

Issue on page /workflow-writing-code.html #35

Description

@crossxwill

VS code now supports running .py scripts in chunks using # %% comments. For example, the following .py script could be executed in two separate chunks by hitting Shift + Enter twice.

# %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Simulate data frame with 3 numeric columns
df = pd.DataFrame({
    'Column1': np.random.rand(100),
    'Column2': np.random.rand(100),
    'Column3': np.random.rand(100)
})


# %%
# create a scatterplot between Column1 and Column2 from df

plt.scatter(df['Column1'], df['Column2'])
plt.xlabel('Column1')
plt.ylabel('Column2')
plt.title('Scatterplot of Column1 vs Column2')
plt.show()


# %%

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions