question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ASCII table reader drops meta data for empty table

See original GitHub issue

Hi!

Firstly thanks for all the great work!!

Secondly, it may be a stupid question (or I’m incompetent when it comes to reading the docs), but it seems that ascii.read drops any meta data when passed an empty table. Is there a way to force it to keep the comments even if the table is empty?

Here’s what I have:

>>> from astropy.io import ascii
>>>
>>> tbl = ascii.read("""
... # hello
... # world
... name place
... """)
>>>
>>> tbl.meta
OrderedDict()

When reading the empty table, the .meta dict is empty, even though there are comments

>>> tbl = ascii.read("""
... # hello
... # world
... name  place
... earth home
... """)
>>>
>>> tbl.meta
OrderedDict([('comments', ['hello', 'world'])])

But as soon as there is one or more entries in the table, the .meta contains the comments.

Is there anyway around this? Maybe by specifying a specific reader?

Many thanks for all you do!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
taldcroftcommented, Dec 13, 2018

See #8274 for a fix.

0reactions
astronomykcommented, Dec 13, 2018

@taldcroft Brilliant! Thanks heaps for the tip. I wasn’t overjoyed by my workaround 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading Tables — Astropy v5.2
ASCII data tables can contain bad or missing values. A common case is when a table contains blank entries with no available data....
Read more >
Create and use tables | BigQuery - Google Cloud
You can create an empty table with a schema definition in the following ways: ... If the cached metadata is older than that,...
Read more >
Table SQL Statements - Dremio docs
The following SQL commands are documented on this page: CREATE TABLE AS; DESCRIBE TABLE; ALTER TABLE; DROP TABLE. CREATE TABLE AS. The CREATE...
Read more >
Analyzing tables - Amazon Redshift - AWS Documentation
The ANALYZE operation updates the statistical metadata that the query planner uses to build and choose optimal plans.
Read more >
asciitable 0.8.0 documentation
Asciitable can read and write a wide range of ASCII table formats via ... empty data value in the x or y columns...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found