On 9/21/2019 11:53 AM, Dave Martin wrote:

# starAbsMags=df['radial_velocity']

#GaiaPandasEscapeVelocityCode

import pandas as pd
import numpy as np
from astropy.io import fits
import astropy
import matplotlib.pyplot as plt


#get the combined data and load the fits files

fits_filename="Gaia_DR2/gaiadr2_100pc.fits"
df=pd.DataFrame()
with fits.open(fits_filename) as data:
df=pd.DataFrame(data[1].data)

A 'with' statement is a compound statement. It must be followed by a 'suite', which usually consists of an indented block of statements.
This is line 17 from the first non-blank line you posted.

Please stop spamming the list with multiple posts. Do spend a few hours reading the tutorial until you understand my answer. https://docs.python.org/3/tutorial/index.html Also read https://stackoverflow.com/help/minimal-reproducible-example
so you can ask better questions.

I presume you got "SyntaxError: expected an indented block".
A minimal example getting this error is, for instance,

while True:
a = 1

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to