Now let's explore the next interesting variable - gender.
display(data["gender"].value_counts())
sns.countplot("gender",data=data,palette="Set3")
M 1952
curl -X GET "localhost:9200/enwikiquote/_search" | |
-H "Content-Type: application/json" | |
-d '{ "query" : {"match" : {"title": "Einstein"}}}' |
export es=localhost:9200 | |
export index=enwikiquote | |
cd chunks | |
for file in *; do | |
echo -n "${file}: " | |
took=$(curl -H "Content-Type: application/json" -s -XPOST $es/$index/_bulk?pretty --data-binary @$file | | |
grep took | cut -d':' -f 2 | cut -d',' -f 1) | |
printf '%7s\n' $took | |
[ "x$took" = "x" ] || rm $file |
export dump=enwikiquote-20180924-cirrussearch-content.json.gz | |
export index=enwikiquote | |
mkdir chunks | |
cd chunks | |
gzcat ../$dump | split -a 10 -l 500 - $index |
export es=localhost:9200 | |
export site=en.wikiquote.org | |
export index=enwikiquote | |
curl -XDELETE $es/$index?pretty | |
curl -s "https://'$site'/w/api.php?action=cirrus-settings-dump&format=json&formatversion=2" | | |
jq '{ | |
analysis: .content.page.index.analysis, | |
number_of_shards: 1, |
wget https://dumps.wikimedia.org/other/cirrussearch/20180924/enwikiquote-20180924-cirrussearch-content.json.gz |
function _update_ps1() { | |
PS1=$(powerline-shell $?) | |
} | |
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then | |
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" | |
fi |
#!/bin/bash | |
let i = 1 | |
for f in "."/* | |
do | |
echo $i | |
echo $f | |
let "i++" | |
done |
Expected Value for 1 : 3.0 | |
Expected Value for 2 : 5.777777777777778 | |
Expected Value for 3 : 8.333333333333334 | |
Expected Value for 4 : 10.666666666666666 | |
Expected Value for 5 : 12.777777777777779 | |
Expected Value for 6 : 14.666666666666666 | |
Expected Value for 7 : 15.555555555555555 | |
Expected Value for 8 : 16.0 | |
Expected Value for 9 : 15.0 | |
The card value to be used by the detective is: 8 |
############################################################################### | |
# Stolen Rubies Problem | |
############################################################################### | |
from collections import defaultdict | |
def expectedValueDetective(cardValue, x, y, z): | |
""" | |
This functions returns the number of rubies for | |
a given cardValue and rubies in each box | |
Now let's explore the next interesting variable - gender.
display(data["gender"].value_counts())
sns.countplot("gender",data=data,palette="Set3")
M 1952