0
$\begingroup$

In the process of editing and manipulating web-derived data I am using Mathematica to assist in editing of tabular data entries. In my case the, data are served as Excel xls files that can be readily imported to Mathematica containing both headers (column labels) in the first row and data values in a subsequent rows.

These can be readily converted into a Mathematica Datset using the following code:

With[{header = First@vertNetPontinus}, 
  AssociationThread[header -> #] & /@ Rest@vertNetPontinus] // Dataset

where vertNetPontinus is simply a name I give to the imported datafile on use of Import (ie all downloadable records of the genus Pontinus in the VertNet.org database in case one wishes to see data that manifest this problem). SemanticImport seems to consistently fail in the .txt or .cvs files created by Excel are used, at least in naked form.

If I inspect both labels and the subsequent data in each [[row,column]] element of the dataset, in both cases the data are correctly imported. However, when the data are displayed as a Mathematica Dataset both the labels and data are truncated and not fully visible even though they are faithfully imported if examined outide of the Dataset display.

It appears that the displayed data are truncated as the many long textual entries have generated by the displayed tablabulr format in columns that are too narrow. On the other hand, the labels, which are much shorter appear only partially visible even though there is plenty of space to be fully display them. Typically, the labels are truncated in mid character with at most only two or possibly three characters fully visible in the displayed table.

Is there a way to control the column widths in a DataSet display so that the column widths are expanded to permit their complete visual repreentation the largest text entry and the column headers are faithfully displayed (ie with their full textual characterization visible in all columns?

Has anyone else experienced this behavior and found a way to overcome it?

This does not seem to be a problem with the Excel format as if I first convert the Excel file into a csv format and import that, I get the same result.

It would seem that this automatic truncation might be useful for small datasets to appear on a single screen without horizontal scrolling. Nonetheless, since DataSet generates a display with both column and row sliders, it shouldn't be necessary to for the display to truncate the visually correct results.

Since my goal is to build a consistent format for both headers and content from other related online databases that often use the same header labels for different content and to edit such data across all datasets using consistent set of rules, being able to see the complete headers and data values is important in avoiding confusion, spotting data errors, and avoiding erroneous results after applying Mathatmica functions to manipulate data.

$\endgroup$
3
$\begingroup$

It sounds like you are after a user interface capability. It also sounds as if your data structure is very flat dimensionally. Dataset may not be your best choice. That said you mention an ability to edit data.

Dataset is very good for querys and operations on data but much less so for viewing data. My practice is to use Dataset as the repository that I operate on and Grid to create veiws Grid is flexable in formating ways you desire.

You can have Controls in a Manipulate to really has it up.

$\endgroup$
  • $\begingroup$ Yes, my plan is to use it primarily as a repository as I have the ability to manipulate it otherwise. However since I must manipulate in many different contexts/formats, I was hoping that the display might obviate the need for a lot of extra programming, just to generagte a clean display. I'll accept your suggestion to look into Grid and Manipulate for the display, although as you note DataSet makes it easy to filter datafiles, whether or not they are flat. Thanks for responding. $\endgroup$ – Stuart Poss Mar 11 '18 at 18:20
  • $\begingroup$ I operate a great deal on Dataset. It's so convenient I do all my preliminary data work with it. Once I have what I'm after I work on UI and format considerations. I find UI always takes more time than I wished it would - but I'm impatient. Happy to help. $\endgroup$ – Mitch Mar 14 '18 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.