Reputation: 793
Two related questions about implementing masking in a large table.
I am working on a large Table with 50+ columns (merged from different sources). The missing values the columns are either NaN, 0, or empty. I would like to create a mask to find those values and use the same missing value for all. I cannot find a way to do without creating masks for each column.
astropy.table.Table also allows for displaying a sortable table in a web browser using:
t.show_in_browser(jsviewer=True)
It would be great to display the missing values as blank or '--'. Thanks for your help.
Upvotes: 0
Views: 1599
Reputation: 2542
Yes, what @iguananaut said. E.g. assuming your current table is named dat
:
dat = Table(dat, masked=True) # Convert to a masked table
for col in dat.columns.values():
col.mask = np.isnan(col) | (col == 0.0)
I'm not sure what you mean by "empty", but the above code should get you started.
As far as I know a masked table will be displayed correctly with the JSviewer output (with --
for missing elements), it just cannot be sorted.
Upvotes: 1