I am trying to use one cell in databricks to display a dataframe and print some text underneath the display. I can't find anything on it on either the Databricks forum or here. It's a devilishly simple question so apologies if it is obvious.
myDF is a a pyspark.sql.dataframe
What I'm doing is:
myString = 'aasdf45'
print(myString)
display(myDF)
The output of the cell displays the DF, but the text isn't printed.
If I do this the other way around, printing the string after the display the result is still the same, showing the dataframe but no printed string:
myString = 'aasdf45'
display(myDF)
print(myString)
It seems like the behaviour is to display the DF over anything else. Is there a way I can show both? It's fine if not but it would be great to know.
Many thanks,
Unfortunately, as things stand with Databricks, you cannot combine a table display with other content. You'll have to put the other content in a separate cell before/after the cell output.
The only alternative for single cell output is quite complicated:
Collect the data you need to the driver using df.collect().
Generate HTML for the content you need, e.g., build a TABLE from your data.
Use displayHTML()
Related
I'm working on an MacOS/Cocoa app where an NSTableView contains information on multiple items where information on each item is displayed on multiple rows in a multi-column table with a table-wide "title" row displayed above the information for each item's data.
Here I have three columns: "Page", "Term" and "Popularity". I've implemented code that sets the formatting of the cells in the title row to black with white text via tableView(:viewFor:row:) and have also created a custom row object (the light blue) via custom NSTableRowView::draw( dirtyRect: NSRect).
However, I also need to have the title (truncated to "Her" in this case) span the entire table width and have not found any solutions posted for something like this. Basically I just need the view for the black row w/white text go all the way across all three columns.
Researching the problem I've found a number of potential leads for possible solutions but none seem like a clear winner:
Use of the custom NSTableViewRow and a hand-added NSTextField that floats above the cells in the table, though I've not tried it yet and no idea if the scrolling/stacking will be a headache. Not even sure how to implement something like that but I imagine I could figure it out.
Apple documentation refers to NSTableViewRow::var isGroupRowStyle but I cannot find for the life of me any documentation that actually explains what that's for / how it's used so no idea if that would be of help.
The use of NSTableView "Sections" was also recommended and looks very promising. However it looks to be iOS specific (could be wrong here) and I've not found anything like an example that shows it working w/multiple columns.
Basically what I'm needing is something simple like the HTML RowSpan feature but that's probably expecting too much. Any suggestions for best solutions for this and/or coding examples I could look at?
I have read about using VBA to concatenate terms together using VbCrLf; I personally used Ctrl-Enter to create a second line in the caption field in the properties box.
But, after I do my ctrl-enter, it then only shows the first line of my multi-line caption in the datasheet view of my form.
becomes this...
This form is meant to recreate the functionality our owner is looking for from a current excel spreadsheet (the ability to sort on various columns), so I can't just use a report.
Please tell me I'm missing something obvious such as a caption height property value or something. The multiline caption will be very useful to help maintain appropriate column widths for the data.
Whilst you can display multiple lines of content within the datasheet view for a table by increasing the row height of each record, e.g.:
A more appropriate solution might be to use a text box on a form to display the data, where the height of the text box can be predefined in the design of the form, and scroll bars can be displayed:
There is no solution to adjusting column headers in the specific "datasheet" form that I was trying to use. It's a nice quick way that works for 95% of your uses. But, if you need more control (like me and others on the internet) the only solution is to create the form as a "Tabular" form in the form wizard. There are other descriptions of this type of form in Access (just to be confusing).
This is also described as a continuous form likely because that's the form property value toggle when you dive into the details.
It's more work but you have full control over the size, format, etc. of your column headers when creating/designing a tabular form.
Pretty simple issue, I'd like to display boolean values in my react-data-grid. I honestly don't care how it's displayed: Checkbox, Radio, text... I just want it to appear so I can edit it.
I'd rather not convert my data to all strings, then have to reconvert them back but that may be the only way.
This is a related issue that was just simply closed: https://github.com/adazzle/react-data-grid/issues/722
There's also a similar question: Using CheckboxEditor with react-data-grid asked yesterday and completely silent.
Does anyone have any way to show and edit boolean values in React-Data-Grid, or should I be looking elsewhere.
Since it's Boolean you can have a dropddown. I don't have a demo to show, but you can get the idea of what to do by looking at the following example.
Link.
There see the logic behind "Issue Type" Column.
I'm having trouble reading a PDF with header and footer but with 2 columns in your body.
I already have the column widths and height of the header but I need the code to read the pages with columns.
Can anyone provide me a piece of code that reads PDF with columns?
thank you
It's very hard to achieve what you want if you don't know the position of the columns, but I assume that you have its coordinates because you say "I already have the column widths and height". In that case, your question isn't that different from this other question posted on StackOverflow: iTextSharp read from specific position
Suppose that rect is a Rectangle corresponding with the position of a column, then you need this code:
RenderFilter[] filter = {new RegionTextRenderFilter(rect)};
ITextExtractionStrategy strategy = new FilteredTextRenderListener(
new LocationTextExtractionStrategy(), filter);
String single_column = PdfTextExtractor.GetTextFromPage(reader, i, strategy));
Now you have the text in a single column. You need to repeat this for every column on your page.
Extra comment: While in most cases using the RegionTextRenderFilter will work just fine, a few cases (in which columns are created by simply inserting additional space characters in the lines) might require to split the text chunks to process in advance. This can be done e.g. by using the TextRenderInfoSplitter from this answer and wrapping the FilteredTextRenderListener in it. (This comment was provided by mkl.)
I've created a BIRT report in Eclipse (Juno) using BIRT v 4.2. The report has four tables, all tables are contained within grids. When I preview the report all the data displays properly, but if I select run as .pdf only a 2-3 rows of each table are displaying. I can export the report as html, xls and view it in web viewer without an issue. Has anyone else experienced this? (I've validated the sizing of the grid and tables).
I had the same issue and to overcome the problem I simply increased the size of the grid to fit the page manually.
If your rows are going to another page you need to script your way around that issue and you can find the solution here:
data cut when exporting as PDF
Update to cover broken link:
Quoting Michael Willians:
The PDF won't adjust like the GUI because of the fixed size constraint. To get a long, unbroken string to break, you'll have to add break characters of your own, either in a computed column or using a dynamic text box to write the script to break the long text up. Once you've broken the long text up, it should wrap to multiple lines within your PDF.
As an example, you could do something like this in a computed column, replacing "data1" with your column's name:
temp = "";
i=0;
while (i<row["data1"].length){
if (row["data1"].length - 10 < i){
temp = temp + row["data1"].substring(i,row["data1"].length);
}
else{
temp = temp + row["data1"].substring(i,i+10) + "\n";
}
i += 10;
}
temp;
To apply changes in the entire report, you could do a script in your beforeFactory method, stepping through your data elements, changing their expression. The easiest way would be to name your data elements, element1, element2, element2, etc., in the property editor. Then, you can easily access them by name, in your script.
Here's were you can edit the beforeFactory method, or any other:
You may also maintain a separate script with all your changes, as you can see on the resources directory:
Remember to add it as a Javascript resource: