Files
FYS-STK4155/doc/LectureNotes/_build/html/reports/chapter1.log
T
Morten Hjorth-Jensen 77d85c179c minor update
2023-11-09 17:52:38 +01:00

72 lines
6.9 KiB
Plaintext

Traceback (most recent call last):
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/jupyter_cache/executors/utils.py", line 51, in single_nb_execution
executenb(
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/client.py", line 1204, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/util.py", line 84, in wrapped
return just_run(coro(*args, **kwargs))
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/util.py", line 62, in just_run
return loop.run_until_complete(coro)
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/client.py", line 663, in async_execute
await self.async_execute_cell(
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/client.py", line 965, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/nbclient/client.py", line 862, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
# Read the experimental data with Pandas
Masses = pd.read_fwf(infile, usecols=(2,3,4,6,11),
names=('N', 'Z', 'A', 'Element', 'Ebinding'),
widths=(1,3,5,5,5,1,3,4,1,13,11,11,9,1,2,11,9,1,3,1,12,11,1),
header=39,
index_col=False)
# Extrapolated values are indicated by '#' in place of the decimal place, so
# the Ebinding column won't be numeric. Coerce to float and drop these entries.
Masses['Ebinding'] = pd.to_numeric(Masses['Ebinding'], errors='coerce')
Masses = Masses.dropna()
# Convert from keV to MeV.
Masses['Ebinding'] /= 1000
# Group the DataFrame by nucleon number, A.
Masses = Masses.groupby('A')
# Find the rows of the grouped DataFrame with the maximum binding energy.
Masses = Masses.apply(lambda t: t[t.Ebinding==t.Ebinding.max()])
------------------
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [8], in <cell line: 2>()
 1 # Read the experimental data with Pandas
----> 2 Masses = pd.read_fwf(infile, usecols=(2,3,4,6,11),
 3  names=('N', 'Z', 'A', 'Element', 'Ebinding'),
 4  widths=(1,3,5,5,5,1,3,4,1,13,11,11,9,1,2,11,9,1,3,1,12,11,1),
 5  header=39,
 6  index_col=False)
 8 # Extrapolated values are indicated by '#' in place of the decimal place, so
 9 # the Ebinding column won't be numeric. Coerce to float and drop these entries.
 10 Masses['Ebinding'] = pd.to_numeric(Masses['Ebinding'], errors='coerce')
File ~/miniforge3/envs/myenv/lib/python3.9/site-packages/pandas/util/_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
 305 if len(args) > num_allow_args:
 306 warnings.warn(
 307 msg.format(arguments=arguments),
 308 FutureWarning,
 309 stacklevel=stacklevel,
 310 )
--> 311 return func(*args, **kwargs)
File ~/miniforge3/envs/myenv/lib/python3.9/site-packages/pandas/io/parsers/readers.py:871, in read_fwf(filepath_or_buffer, colspecs, widths, infer_nrows, **kwds)
 869 len_index = len(index_col)
 870 if len(names) + len_index != len(colspecs):
--> 871 raise ValueError("Length of colspecs must match length of names")
 873 kwds["colspecs"] = colspecs
 874 kwds["infer_nrows"] = infer_nrows
ValueError: Length of colspecs must match length of names
ValueError: Length of colspecs must match length of names