### Bug description

I am trying to run code that works fine in Spyder python 3.9

When I run it in quarto I cannot figure out why I am getting this indentation error
![image](https://user-images.githubusercontent.com/89376037/194979519-2fe6a8b6-0a21-46cb-8e3c-1fb7b99d62dd.png)

Another issue is when I try to preview/double click on my main data sheet imported from excel in the environment panel I get this error:
![image](https://user-images.githubusercontent.com/89376037/194978517-b03dcf64-8b9c-42ca-9e6a-3b008dc78eaf.png)

The raw source code is pasted below 

```{python}

import matplotlib.patches as mpatches

NumSubjects=data['No. Subjects'].astype('str').str.split().str.get(0).str.extract('(\d+)', expand=False).astype(float)
bins=np.histogram(NumSubjects, bins=[0,10,20,50,100, 500] )
ind=np.digitize(NumSubjects, [0,10,20,50,100, 500])
stack=[]
for rn in range(1,len(bins[0])+1):
    stack.append([data['Male'].loc[ind==rn].dropna().astype('str').str.extract('(\d+)').astype(float).sum()[0],data['Female'].loc[ind==rn].dropna().astype('str').str.extract('(\d+)').astype(float).sum()[0]])
```
Thank you

version 2022.07.2 Build 576


### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
2022-10-11T01:45:39Z
GraceEMc
bug needs-repro
v1.3
closed
Can't fix/find python indentation error
https://github.com/quarto-dev/quarto-cli/issues/2789