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.

Table(list_of_dicts) does not work as expected for quantities

See original GitHub issue

Description

Giving Table a list of dicts with quantities results in dtype object with single quantities in each row / column.

Expected behavior

Detect the quantities and create a column that has dtype float and a unit attached.

Actual behavior

See description

Steps to Reproduce

In [1]: from astropy.table import Table

In [2]: import astropy.units as u

In [3]: data = [{'x': 5 * u.m, 'y': 0 * u.m}, {'x': 10 * u.m, 'y': 3 * u.m}]

In [4]: Table(data)
Out[4]: 
<Table length=2>
  x      y   
object object
------ ------
 5.0 m  0.0 m
10.0 m  3.0 m

System Details

Linux-5.10.15-1-MANJARO-x86_64-with-glibc2.33
Python 3.9.1 (default, Feb  6 2021, 06:49:13) 
[GCC 10.2.0]
Numpy 1.20.0
astropy 4.2
Scipy 1.6.0
Matplotlib 3.3.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
maxnoecommented, Feb 15, 2021

That’s probably for another issue, but we found issues with accessing metadata with QTable.

0reactions
taldcroftcommented, Feb 16, 2021

See #11329.

Read more comments on GitHub >

github_iconTop Results From Across the Web

List of unique dictionaries - python - Stack Overflow
The problem, of course, is that a set() can only contain hashable entries, and a dict is not hashable. If I had this...
Read more >
Performance Issues Working with Anvil Data Tables and Row ...
After investigating, it seems that a lot of my issues arose from constructing lists of dicts/AnvilRows from a table.search() .
Read more >
django-tables2 - Read the Docs
In an example we will demonstrate using list of dicts. ... change that you do not want to use in multiple tables or...
Read more >
Tables — RPA Framework documentation
Tables is a library for manipulating tabular data inside Robot Framework. It can import data from various sources and apply different operations to...
Read more >
ansible - Search a list of Dicts using a list of items and find if ...
The condition is true as the 3rd item is not found as expected, but my variable is being set with all items from...
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