Support
Quality
Security
License
Reuse
kandi has reviewed zeppelin and discovered the below as its top functions. This is intended to give you an instant insight into zeppelin implemented functionality, and help decide if they suit your requirements.
Web based notebook style editor.
Built-in Apache Spark support
Cannot find conda info. Please verify your conda installation on EMR
wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh -O /home/hadoop/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p $HOME/conda
echo -e '\n export PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc
conda config --set always_yes yes --set changeps1 no
conda config -f --add channels conda-forge
conda create -n zoo python=3.7 # "zoo" is conda environment name
conda init bash
source activate zoo
conda install python 3.7.0 -c conda-forge orca
sudo /home/hadoop/conda/envs/zoo/bin/python3.7 -m pip install virtualenv
“spark.pyspark.python": "/home/hadoop/conda/envs/zoo/bin/python3",
"spark.pyspark.virtualenv.enabled": "true",
"spark.pyspark.virtualenv.type":"native",
"spark.pyspark.virtualenv.bin.path":"/home/hadoop/conda/envs/zoo/bin/,
"zeppelin.pyspark.python" : "/home/hadoop/conda/bin/python",
"zeppelin.python": "/home/hadoop/conda/bin/python"
-----------------------
wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh -O /home/hadoop/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p $HOME/conda
echo -e '\n export PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc
conda config --set always_yes yes --set changeps1 no
conda config -f --add channels conda-forge
conda create -n zoo python=3.7 # "zoo" is conda environment name
conda init bash
source activate zoo
conda install python 3.7.0 -c conda-forge orca
sudo /home/hadoop/conda/envs/zoo/bin/python3.7 -m pip install virtualenv
“spark.pyspark.python": "/home/hadoop/conda/envs/zoo/bin/python3",
"spark.pyspark.virtualenv.enabled": "true",
"spark.pyspark.virtualenv.type":"native",
"spark.pyspark.virtualenv.bin.path":"/home/hadoop/conda/envs/zoo/bin/,
"zeppelin.pyspark.python" : "/home/hadoop/conda/bin/python",
"zeppelin.python": "/home/hadoop/conda/bin/python"
Does Zeppelin 0.10.0 try to run interpreter in k8s cluster?
gofabric8 start
Printing Unique Values in a Column as a Percentage of Total Rows
import org.apache.spark.sql.functions.{col, countDistinct, count}
import spark.implicits._
// define a dataframe for example
val data = Seq(("1", "1"), ("1", "2"), ("1", "3"), ("1", "4")).toDF("col_a", "col_b")
data.select(data.columns.map(c => (lit(100) * countDistinct(col(c)) / count(col(c))).alias(c)): _*).show()
// output:
+-----+-----+
|col_a|col_b|
+-----+-----+
| 25.0|100.0|
+-----+-----+
User "system:serviceaccount:default:flink" cannot list resource "nodes" in API group "" at the cluster scope
...
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
...
CSS Keyframe Animations
#SLIDE_BG {
width: 100%;
height: 100vh;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
backface-visibility: hidden;
animation: slideBg 8s linear infinite 0s;
animation-timing-function: ease-in-out;
background-image: url('https://dummyimage.com/800x300');
}
@keyframes slideBg {
0% {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/2/29/Dscn7471_sunset-sundog_crop_800x300.jpg');
}
25% {
background-image: url('https://www.thegrandsiba.com/wp-content/uploads/2017/06/MG_28423-800x300.jpg');
}
50% {
background-image: url('https://dummyimage.com/800x300');
}
75% {
background-image: url('https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/5e2a19d4-f261-4548-b4a7-1e2f5ad139af/d99najf-e9049704-bfc4-4836-952d-9315403bd60f.gif');
}
100% {
background-image: url('https://www.businessclass.co.uk/wp-content/uploads/sites/11/2016/04/Toronto-800x300-800x300.jpg');
}
}
-----------------------
#SLIDE_BG {
width: 100%;
height: 100vh;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
backface-visibility: hidden;
animation: slideBg 8s linear infinite 0s;
animation-timing-function: ease-in-out;
background-image: url('https://jooinn.com/images/dramatic-landscape-7.jpg');
}
@keyframes slideBg {
0% {
background-image: url('https://jooinn.com/images/dramatic-landscape-7.jpg');
}
25% {
background-image: url('http://www.thewowstyle.com/wp-content/uploads/2015/01/nature-image.jpg');
}
50% {
background-image: url('https://images.designtrends.com/wp-content/uploads/2016/01/04085621/A-Cold-Sunset-Background.jpg');
}
75% {
background-image: url('https://jooinn.com/images/hdr-landscape-1.jpg');
}
100% {
background-image: url('https://www.shutterstock.com/blog/wp-content/uploads/sites/5/2016/03/fall-trees-road-1.jpg');
}
}
<div id="SLIDE_BG"></div>
-----------------------
#SLIDE_BG {
width: 100%;
height: 100vh;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
backface-visibility: hidden;
animation: slideBg 8s linear infinite 0s;
animation-timing-function: ease-in-out;
background-image: url('https://jooinn.com/images/dramatic-landscape-7.jpg');
}
@keyframes slideBg {
0% {
background-image: url('https://jooinn.com/images/dramatic-landscape-7.jpg');
}
25% {
background-image: url('http://www.thewowstyle.com/wp-content/uploads/2015/01/nature-image.jpg');
}
50% {
background-image: url('https://images.designtrends.com/wp-content/uploads/2016/01/04085621/A-Cold-Sunset-Background.jpg');
}
75% {
background-image: url('https://jooinn.com/images/hdr-landscape-1.jpg');
}
100% {
background-image: url('https://www.shutterstock.com/blog/wp-content/uploads/sites/5/2016/03/fall-trees-road-1.jpg');
}
}
<div id="SLIDE_BG"></div>
totalsupply() is not a function openzeppelin contracts
contract Color is ERC721, IERC721Enumerable { // We must extends IERC721Enumerable
string[] public colors;
mapping(string => bool) _colorExists;
constructor() ERC721("Color", "COLOR") {}
function mint(string memory _color) public {
colors.push(_color);
uint256 _id = colors.length - 1;
// _mint(msg.sender,_id);
_colorExists[_color] = true;
}
// And must override below three functions
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
// You need update this logic.
// ...
return 3;
}
function totalSupply() external view override returns (uint256) {
// You need update this logic.
// ...
return 1;
}
function tokenByIndex(uint256 index) external view override returns (uint256) {
// You need update this logic.
// ...
return 5;
}
}
-----------------------
pragma solidity ^0.8.0; // Note that this is using a newer version than in
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract Color is ERC721, ERC721Enumerable {
string[] public colors;
mapping(string => bool) _colorExists;
constructor() ERC721("Color", "COLOR") public {
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function mint(string memory _color) public {
colors.push(_color);
uint _id = colors.length - 1;
_mint(msg.sender, _id);
_colorExists[_color] = true;
}
}
How can find the find occurence in a window/group and fetch all unbounded rows prior to that?
SELECT
accountId,
customerId,
sessionDate,
didPurchase
FROM (
SELECT
*,
MIN(CASE
WHEN didPurchase THEN sessionDate
END) OVER (
PARTITION BY accountId, customerId
) as prior_oldest_purchase
FROM
myvisits
) v
WHERE
v.sessionDate <= v.prior_oldest_purchase
ORDER BY
accountId DESC, customerId,sessionDate DESC
import org.apache.spark.sql.functions._
import org.apache.spark.sql.expressions.Window
val customerAccountWindow = Window.partitionBy("accountId","customerId")
val outputDf = df.withColumn(
"prior_oldest_purchase",
min(
when(col("didPurchase"),col("sessionDate"))
).over(customerAccountWindow)
)
.where(col("sessionDate") <= col("prior_oldest_purchase"))
.select(
col("accountId"),
col("customerId"),
col("sessionDate"),
col("didPurchase")
)
.orderBy(
col("accountId").desc(),
col("customerId"),
col("sessionDate").desc()
)
from pyspark.sql import functions as F
from pyspark.sql import Window
customerAccountWindow = Window.partitionBy("accountId","customerId")
outputDf = (
df.withColumn(
"prior_oldest_purchase",
F.min(
F.when(F.col("didPurchase"),F.col("sessionDate"))
).over(customerAccountWindow)
)
.where(F.col("sessionDate") <= F.col("prior_oldest_purchase"))
.select(
F.col("accountId"),
F.col("customerId"),
F.col("sessionDate"),
F.col("didPurchase")
)
.orderBy(
F.col("accountId").desc(),
F.col("customerId"),
F.col("sessionDate").desc()
)
)
-----------------------
SELECT
accountId,
customerId,
sessionDate,
didPurchase
FROM (
SELECT
*,
MIN(CASE
WHEN didPurchase THEN sessionDate
END) OVER (
PARTITION BY accountId, customerId
) as prior_oldest_purchase
FROM
myvisits
) v
WHERE
v.sessionDate <= v.prior_oldest_purchase
ORDER BY
accountId DESC, customerId,sessionDate DESC
import org.apache.spark.sql.functions._
import org.apache.spark.sql.expressions.Window
val customerAccountWindow = Window.partitionBy("accountId","customerId")
val outputDf = df.withColumn(
"prior_oldest_purchase",
min(
when(col("didPurchase"),col("sessionDate"))
).over(customerAccountWindow)
)
.where(col("sessionDate") <= col("prior_oldest_purchase"))
.select(
col("accountId"),
col("customerId"),
col("sessionDate"),
col("didPurchase")
)
.orderBy(
col("accountId").desc(),
col("customerId"),
col("sessionDate").desc()
)
from pyspark.sql import functions as F
from pyspark.sql import Window
customerAccountWindow = Window.partitionBy("accountId","customerId")
outputDf = (
df.withColumn(
"prior_oldest_purchase",
F.min(
F.when(F.col("didPurchase"),F.col("sessionDate"))
).over(customerAccountWindow)
)
.where(F.col("sessionDate") <= F.col("prior_oldest_purchase"))
.select(
F.col("accountId"),
F.col("customerId"),
F.col("sessionDate"),
F.col("didPurchase")
)
.orderBy(
F.col("accountId").desc(),
F.col("customerId"),
F.col("sessionDate").desc()
)
)
-----------------------
SELECT
accountId,
customerId,
sessionDate,
didPurchase
FROM (
SELECT
*,
MIN(CASE
WHEN didPurchase THEN sessionDate
END) OVER (
PARTITION BY accountId, customerId
) as prior_oldest_purchase
FROM
myvisits
) v
WHERE
v.sessionDate <= v.prior_oldest_purchase
ORDER BY
accountId DESC, customerId,sessionDate DESC
import org.apache.spark.sql.functions._
import org.apache.spark.sql.expressions.Window
val customerAccountWindow = Window.partitionBy("accountId","customerId")
val outputDf = df.withColumn(
"prior_oldest_purchase",
min(
when(col("didPurchase"),col("sessionDate"))
).over(customerAccountWindow)
)
.where(col("sessionDate") <= col("prior_oldest_purchase"))
.select(
col("accountId"),
col("customerId"),
col("sessionDate"),
col("didPurchase")
)
.orderBy(
col("accountId").desc(),
col("customerId"),
col("sessionDate").desc()
)
from pyspark.sql import functions as F
from pyspark.sql import Window
customerAccountWindow = Window.partitionBy("accountId","customerId")
outputDf = (
df.withColumn(
"prior_oldest_purchase",
F.min(
F.when(F.col("didPurchase"),F.col("sessionDate"))
).over(customerAccountWindow)
)
.where(F.col("sessionDate") <= F.col("prior_oldest_purchase"))
.select(
F.col("accountId"),
F.col("customerId"),
F.col("sessionDate"),
F.col("didPurchase")
)
.orderBy(
F.col("accountId").desc(),
F.col("customerId"),
F.col("sessionDate").desc()
)
)
1st Sept coming before 31st Aug in bar chart ordering by date in Zeppelin, how to fix please?
SELECT FROM_TIMESTAMP(DATE_TRUNC('HOUR', concat(replace(my_timestamp,'"',''), "Z")), 'd MMM HH:mm') AS hours,
FROM_TIMESTAMP(DATE_TRUNC('HOUR', concat(replace(my_timestamp,'"',''), "Z")), 'yyyy-MM-dd HH:mm') as dt,
COUNT(my_number) AS "number per hour"
FROM my_table
WHERE unix_timestamp(my_timestamp) --also it seems Z should be removed, etc
> (unix_timestamp(now()) - 86400)
GROUP BY dt, hours
ORDER BY dt
LIMIT 24;
AWS EMR: Zeppelin taking numpy version from python 2.7 instead of higher version
sudo python3 -m pip install h5py==2.10.0
sudo python3 -m pip install keras==2.3.1
sudo python3 -m pip install keras_applications==1.0.8 --no-deps
sudo python3 -m pip install keras_preprocessing==1.1.0 --no-deps
sudo python3 -m pip install tqdm==4.40.0
sudo python3 -m pip install s3fs
sudo python3 -m pip install ipaddress==1.0.23
sudo python3 -m pip install netaddr==0.7.19
sudo python3 -m pip install matplotlib
sudo python3 -m pip install pyarrow==0.12.1
sudo python3 -m pip install boto3
sudo python3 -m pip install torch==1.6.0
sudo python3 -m pip install --upgrade scipy==1.4.1
sudo python3 -m pip install torchvision
sudo python3 -m pip install pydot==1.4.1
sudo python3 -m pip install xlrd
sudo python3 -m pip install xlwt
sudo python3 -m pip install pandas==1.2.0
sudo python3 -m pip install scikit-learn
sudo python3 -m pip install scikit-multilearn
sudo python3 -m pip install wrapt==1.12.0
sudo python3 -m pip install tensorboard==2.1.0
sudo python3 -m pip install tensorflow==2.1.0
sudo python3 -m pip install tensorflow-estimator==2.1.0
Apache Zeppelin - Jquery datepicker in angular cell doesn't work
%angular
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script>
angular.element( function() {
angular.element( "#todatepicker" ).datepicker({ dateFormat: 'yy-mm-dd',changeMonth: true,changeYear: true, minDate: new Date(1900, 1, 1), yearRange: '1900:+00' });
angular.element( "#fromdatepicker" ).datepicker({ dateFormat: 'yy-mm-dd',changeMonth: true,changeYear: true, minDate: new Date(1900, 1, 1), yearRange: '1900:+00' });
} );
function changeMaxDate(val){
angular.element('#fromdatepicker').datepicker('option', 'maxDate', new Date(val));
}
function changeMinDate(val){
angular.element('#todatepicker').datepicker('option', 'minDate', new Date(val));
}
</script>
<form class="form-inline">
<div style="text-align:center; margin-bottom:20px">
<button type="submit" class="btn btn-primary" ng-click="z.runParagraph('20210728-173149_661735685')" > Load data </button>
</div>
<div style="text-align:center">
<label for="fromDateId" >From: </label>
<input type="text" id="fromdatepicker" ng-model="fromDate" onChange="changeMinDate(this.value);" autocomplete="off"> </input>
<label for="toDateId"style="margin-left:5px"> to: </label>
<input type="text" id="todatepicker" ng-model="toDate" onChange="changeMaxDate(this.value);" autocomplete="off"> </input>
<label style="margin-left:30px"> City: </label>
<input type="text" ng-model="city"> </input>
<label for="genders" style="margin-left:30px">Gender:</label>
<select name="genders" id="genders" ng-model="gender">
<option value="both">Both</option>
<option value="F">Female</option>
<option value="M">Male</option>
</select>
</div>
<div style="text-align:center; margin-top:20px">
<button type="submit" class="btn btn-primary" ng-click="z.angularBind('toDate',toDate,'20210727-110725_1586668489');z.angularBind('fromDate',fromDate,'20210727-110725_1586668489');z.angularBind('city',city,'20210727-110725_1586668489');z.angularBind('gender',gender,'20210727-110725_1586668489');z.runParagraph('20210727-110725_1586668489');z.runParagraph('20210727-111144_1584153174')">Search</button>
</div>
</form>
QUESTION
Cannot find conda info. Please verify your conda installation on EMR
Asked 2022-Feb-05 at 00:17I am trying to install conda on EMR and below is my bootstrap script, it looks like conda is getting installed but it is not getting added to environment variable. When I manually update the $PATH
variable on EMR master node, it can identify conda
. I want to use conda on Zeppelin.
I also tried adding condig into configuration like below while launching my EMR instance however I still get the below mentioned error.
"classification": "spark-env",
"properties": {
"conda": "/home/hadoop/conda/bin"
}
[hadoop@ip-172-30-5-150 ~]$ PATH=/home/hadoop/conda/bin:$PATH
[hadoop@ip-172-30-5-150 ~]$ conda
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
#!/usr/bin/env bash
# Install conda
wget https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-x86_64.sh -O /home/hadoop/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p $HOME/conda
conda config --set always_yes yes --set changeps1 no
conda install conda=4.2.13
conda config -f --add channels conda-forge
rm ~/miniconda.sh
echo bootstrap_conda.sh completed. PATH now: $PATH
export PYSPARK_PYTHON="/home/hadoop/conda/bin/python3.5"
echo -e '\nexport PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc
conda create -n zoo python=3.7 # "zoo" is conda environment name, you can use any name you like.
conda activate zoo
sudo pip3 install tensorflow
sudo pip3 install boto3
sudo pip3 install botocore
sudo pip3 install numpy
sudo pip3 install pandas
sudo pip3 install scipy
sudo pip3 install s3fs
sudo pip3 install matplotlib
sudo pip3 install -U tqdm
sudo pip3 install -U scikit-learn
sudo pip3 install -U scikit-multilearn
sudo pip3 install xlutils
sudo pip3 install natsort
sudo pip3 install pydot
sudo pip3 install python-pydot
sudo pip3 install python-pydot-ng
sudo pip3 install pydotplus
sudo pip3 install h5py
sudo pip3 install graphviz
sudo pip3 install recmetrics
sudo pip3 install openpyxl
sudo pip3 install xlrd
sudo pip3 install xlwt
sudo pip3 install tensorflow.io
sudo pip3 install Cython
sudo pip3 install ray
sudo pip3 install zoo
sudo pip3 install analytics-zoo
sudo pip3 install analytics-zoo[ray]
#sudo /usr/bin/pip-3.6 install -U imbalanced-learn
ANSWER
Answered 2022-Feb-05 at 00:17I got the conda working by modifying the script as below, emr python versions were colliding with the conda version.:
wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh -O /home/hadoop/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p $HOME/conda
echo -e '\n export PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc
conda config --set always_yes yes --set changeps1 no
conda config -f --add channels conda-forge
conda create -n zoo python=3.7 # "zoo" is conda environment name
conda init bash
source activate zoo
conda install python 3.7.0 -c conda-forge orca
sudo /home/hadoop/conda/envs/zoo/bin/python3.7 -m pip install virtualenv
and setting zeppelin python and pyspark parameters to:
“spark.pyspark.python": "/home/hadoop/conda/envs/zoo/bin/python3",
"spark.pyspark.virtualenv.enabled": "true",
"spark.pyspark.virtualenv.type":"native",
"spark.pyspark.virtualenv.bin.path":"/home/hadoop/conda/envs/zoo/bin/,
"zeppelin.pyspark.python" : "/home/hadoop/conda/bin/python",
"zeppelin.python": "/home/hadoop/conda/bin/python"
Orca only support TF upto 1.5 hence it was not working as I am using TF2.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Save this library and start creating your kit
Save this library and start creating your kit