In Jupyter, I'd like to add syntax highlighting to Raw NBConvert cells (based on type). I'm looking for either (a) an existing plugin that accomplishes this or (b) some direction on writing a plugin to accomplish this.
Related
my usecase:
i have an excel spreadsheet and a python function that uses pandas to take advantage of my spreadsheet. I would like to select some data (table/entire sheet to be precise) and would like to pass that data to a custom function i wrote in python and the I want the function to return a dataframe that i would want to show in the spreadsheet.
Apparently, i have followed through the documentation but found On Mac, all UDF related functionality is not available. on the Xlwings doc page. Since this is for my work i cannot use another machine and apparently, the requirement cannot be achieved using the xlwings addin for macos MSExcel.
Are there any alternatives for achieving the same? Also, please correct me, if i got it anywhere wrong or any thing that i should do in making my requirement work in my environment?
I am using Wrangler to read an excel and transform.
Issue is wrangler gives option for sheet number\name, what I need is to also specify the columns to be read eg 'B1:E450'. I could not get any combination of column declaration to work. Any help is appreciated.
You could use the Excel source plugin in the Pipeline Studio, which would let you specify the columns and a row cap to import from the file. To use Wrangler after that, however, you'd have to manually enter the directives using the Properties view in the Studio.
How to make the notebook cmd title has format like in the picture ?
You can use markdown for this:
%md
###The next command...
1. Select color...
2. Displays a table...
See also the Databricks documentation.
I have a code where I am writing a xlsx file :
...
...
df.to_excel(finalname,index=False,header=False)
Example:
I would like to write the excel file with color, but just in the first row, like the follow image:
Maybe I can use the df.style.apply,
I tryed that:
result.style.apply('background-color: gray',row=[1], axis=1)
But it isnĀ“t working
style.apply is the correct way ?
If not, how can I get the result of the second image?
You can checkout the python package xlwings
Here's how I set an excel range's color:
import xlwings as xw
df.to_excel(finalname,index=False,header=False)
wb = xw.Book(finalname)
# color is set with an rgb value
wb.sheets['yoursheet'].range('A').color = (169,169,169)
I've not adjusted the text color before but I'm pretty sure it's possible.
xlwings is built on top of pywin32
According to the docs you may be able to get away with setting something like this:
wb.sheets['sheet1'].range('A').api.Font.ColorIndex = 3
I saw the other answer, but you can also do this with df.style().
You have two problems. Fist, you are using the wrong syntax. Second, you are trying to style the first row of the data and not the header of the document. The easiest way to get what you are describing would be to use a CSS selector.
df.style.set_table_styles([{'selector': 'th', 'props': [('background-color', 'gray')]}])\
.to_excel('styled.xlsx', engine='openpyxl')
You also did not export it to excel, just rendered it. The .to_excel part is telling it to export. See documentation for more information.
you can fill a cell with '=cos(0)' and you get displayed its value '1'.
is there some similar function(ality) to choose the font-color?
something like '=COLOR(the text to display, #FF0000)'.
if not, how could you achieve something like that?
here is where I come from: I write data to an excel-file (using KNIME btw) and I want to choose the font-color.
When this question was raised in the Knime forums a couple of months ago, it didn't elicit much response, so I suspect the answer is simply "No". There were plans back in 2007 for Knime to start using Apache POI to write Excel files, which should have allowed formatting, but I don't know if this ever happened... if it didn't, then Knime is probably still just writing a CSV file for Excel, which doesn't support any formatting.