Markdown table in Jupyter notebook not working - jupyter-notebook

I know how to set to up a table in a jupyter notebook`. I even looked up internet and imitated it. However it is not working? Anyone can tell me what is wrong with my notebook, is there anything I should change while constructing markdown table
Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |

Two things:
the example code is missing the first | character
dollar signs need to be escaped with a backslash (\) since MathJax is enabled
Try this:
|Tables | Are | Cool |
| ------------- |:-------------:| ------:|
| col 3 is | right-aligned | \$1600 |
| col 2 is | centered | \$12 |
| zebra stripes | are neat | \$1 |

Related

Jupyter Notebook and Lab can not render this markdown snippet from Google Colab

This is how it looks on Google Colab when rendered,
The actual script
# Notation
Here is a summary of some of the notation you will encounter.
|General <img width=70/> <br /> Notation <img width=70/> | Description<img width=350/>| Python (if applicable) |
|: ------------|: ------------------------------------------------------------||
| $a$ | scalar, non bold ||
| $\mathbf{a}$ | vector, bold ||
| **Regression** | | | |
| $\mathbf{x}$ | Training Example feature values (in this lab - Size (1000 sqft)) | `x_train` |
| $\mathbf{y}$ | Training Example targets (in this lab Price (1000s of dollars)). | `y_train`
| $x^{(i)}$, $y^{(i)}$ | $i_{th}$Training Example | `x_i`, `y_i`|
| m | Number of training examples | `m`|
| $w$ | parameter: weight, | `w` |
| $b$ | parameter: bias | `b` |
| $f_{w,b}(x^{(i)})$ | The result of the model evaluation at $x^{(i)}$ parameterized by $w,b$: $f_{w,b}(x^{(i)}) = wx^{(i)}+b$ | `f_wb` |
However, in my local Jupyter Notebook/Lab it doesn't render correctly, I installed these extensions in Jupyter Lab
still it won't render and looks something like this
Try this below, as it is close:
# Notation
Here is a summary of some of the notation you will encounter.
| General <br> Notation <br /> | Description | Python (if applicable) |
| :-: | :----: | :- |
| $$a$$ | scalar, non bold ||
| $$\mathbf{a}$$ | vector, bold ||
| **Regression** | | | |
| $$\mathbf{x}$$ | Training Example feature values (in this lab - Size (1000 sqft)) | `x_train` |
| $$\mathbf{y}$$ | Training Example targets (in this lab Price (1000s of dollars)). | `y_train`
| $$x^{(i)}, y^{(i)}$$ | $$i_{th}$$Training Example | `x_i`, `y_i`|
| m | Number of training examples | `m`|
| $$w$$ | parameter: weight, | `w` |
| $$b$$ | parameter: bias | `b` |
| $$f_{w,b}(x^{(i)})$$ | The result of the model evaluation at $$x^{(i)}$$ parameterized by $$w,b$$: $$f_{w,b}(x^{(i)}) = wx^{(i)}+b$$ | `f_wb` |
Yields in classic notebook in session launched here:
Most of the issue is explained by here; it seems you need to use double dollar signs when embedding latex in a table. So for all but the first few rows, I simply did find replace to double the dollar sign symbols, and then pasted that in. ( I later realized I needed to hand edit the $$x^{(i)}, y^{(i)}$$ line.) The first few rows I did by hand trying to understand how they matched and attempting to control the alignment.
I cannot say what is going on with the alignment. According to here and even using that code there's a way to align left the first column. It kept messing up the table though incorporating that and the latex.

Can the TopDockWidgetArea dock widgets in a vertical layout

The top dock widget area works like a Splitter in Horizontal orientation (with additionally stacking tab feature not relevant to this question) as such:
_____________________
| | | |
| A| B | C |
|___|_______|_________|
| | | |
| | | |
| | | |
|___|_____________|___|
| |
|_____________________|
Is it possible to make this dock area work like a Vertical QSplitter instead as:
_____________________
| A |
|_____________________|
| B |
|_____________________|
| C |
|_____________________|
| | | |
| | | |
|___|_____________|___|
| |
|_____________________|
I was very surprised that this is very easy to achieve.
Look into the DockWidget Example from Qt! There are some options for the DockArea. In the Mainwindow the options have to be applied:
setDockNestingEnabled(true)
Here is the documentation

Split column string with delimiters into separate columns in azure kusto

I have a column 'Apples' in azure table that has this string: "Colour:red,Size:small".
Current situation:
|-----------------------|
| Apples |
|-----------------------|
| Colour:red,Size:small |
|-----------------------|
Desired Situation:
|----------------|
| Colour | Size |
|----------------|
| Red | small |
|----------------|
Please help
I'll answer the title as I noticed many people searched for a solution.
The key here is mv-expand operator (expands multi-value dynamic arrays or property bags into multiple records):
datatable (str:string)["aaa,bbb,ccc", "ddd,eee,fff"]
| project splitted=split(str, ',')
| mv-expand col1=splitted[0], col2=splitted[1], col3=splitted[2]
| project-away splitted
project-away operator allows us to select what columns from the input exclude from the output.
Result:
+--------------------+
| col1 | col2 | col3 |
+--------------------+
| aaa | bbb | ccc |
| ddd | eee | fff |
+--------------------+
This query gave me the desired results:
| parse Apples with "Colour:" AppColour ", Size:" AppSize
Remember to include all the different delimiters preceding each word you want to extract, e.g ", Size". Mind the space between.
This helped me then i used my intuition to customize the query according to my needs:
https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/parseoperator

rmarkdown - prevent indentation in list inside a table

When rendering tables such as this one (using RStudio + knitr), there is unwanted indentation (see red zone in the image). How can I avoid such indentation?
I imagine there is some CSS involved, but if there was a way to even prevent rmarkdown from "considering" this as a list, it could simplify matters. This is needed for an R package, so heavy hacks are not really an option, but I'll gladly receive all suggestions. Thx.
The (grid) table:
+------------------------+------------------------------------+
| Variable | Stats / Values |
+========================+====================================+
| SomeVar1 | mean (sd) : 1500000.5 (288675.28)\ |
| [numeric] | min < med < max :\ |
| | 1000001 < 1500000.5 < 2e+06\ |
| | IQR (CV) : 499999.5 (0.19) |
+------------------------+------------------------------------+
| SomeVar2 | 1. AAAAAA\ |
| [factor] | 2. BBBBBB\ |
| | 3. CCCCCC\ |
| | 4. DDDDDD\ |
| | 5. EEEEEE\ |
| | 6. FFFFFF\ |
| | 7. GGGGGG\ |
| | 8. HHHHHH\ |
| | 9. IIIIII\ |
| | 10. JJJJJJ\ |
| | [ 102917 others ] |
+------------------------+------------------------------------+
The rendered html table:

R - Multiple search and replace based on partial match within a column of a dataframe

I have a list of publisher that looks like this :
+--------------+
| Site Name |
+--------------+
| Radium One |
| Euronews |
| EUROSPORT |
| WIRED |
| RadiumOne |
| Eurosport FR |
| Wired US |
| Eurosport |
| EuroNews |
| Wired |
+--------------+
I'd like to create the following result:
+--------------+----------------+
| Site Name | Publisher Name |
+--------------+----------------+
| Radium One | RadiumOne |
| Euronews | Euronews |
| EUROSPORT | Eurosport |
| WIRED | Wired |
| RadiumOne | RadiumOne |
| Eurosport FR | Eurosport |
| Wired US | Wired |
| Eurosport | Eurosport |
| EuroNews | Euronews |
| Wired | Wired |
+--------------+----------------+
I would like to understand how I can replicate this code I use in Power Query :
search first 4 characters
if Text.Start([Site Name],4) = "WIRE" then "Wired" else
search last 3 characters
if Text.End([Site Name],3) = "One" then "RadiumOne" else
If no match is found, then add "Rest"
It does not have to be case sensitive.
Using properCase from ifultools package and gsub, we replace everything after first word with "" i.e delete it and treat the exceptional case of Radium separtely. If you have many exceptions like Radium case, please update your post with those so that we can find a neater solution to this hack :)
library("ifultools")
siteName=c("Radium One","Euronews","EUROSPORT","WIRED","RadiumOne","Eurosport FR","Wired US","Eurosport","EuroNews","Wired")
publisherName = gsub("^Radium$","Radiumone",gsub("\\s+.*","",properCase(siteName)))
# [1] "Radiumone" "Euronews" "Eurosport" "Wired" "Radiumone" "Eurosport" "Wired"
# [8] "Eurosport" "Euronews" "Wired"

Resources