Python shows error on line 15 that i cant fix

Dave Martin dschwartz0705 at gmail.com
Sat Sep 21 13:57:15 EDT 2019


On Saturday, September 21, 2019 at 1:33:12 PM UTC-4, Terry Reedy wrote:
> 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

Can you provide an example of how to use the suite feature. Thank you. 



More information about the Python-list mailing list