Skip to content

Commit

Permalink
fixed issue in parser when trying to parse empty loop blocks (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
andschenk authored Oct 23, 2024
1 parent a2e9927 commit a81abc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/starfile/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ def _parse_loop_block(self) -> pd.DataFrame:
loop_data += '\n'

# put string data into a dataframe
if loop_data == '\n':
if loop_data.startswith('\n'):
n_cols = len(loop_column_names)
df = pd.DataFrame(np.zeros(shape=(0, n_cols)))
df.columns = loop_column_names
else:
column_name_to_index = {col: idx for idx, col in enumerate(loop_column_names)}
df = pd.read_csv(
Expand Down

0 comments on commit a81abc3

Please sign in to comment.