View jupyterlab-d3.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View interactivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.core.interactiveshell import InteractiveShell | |
InteractiveShell.ast_node_interactivity = "all" |
View wordcloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wc = WordCloud(background_color="white", max_words=1000, | |
stopwords=STOPWORDS,width=1000,height=1000) | |
wc.generate(texts with space) | |
plt.imshow(wc) | |
plt.show() |
View subplot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig, ax = plt.subplots(nrows, ncols, figsize=(8, 8)) |
View figure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plt.figure(figsize=(8, 8)) | |
plt.show() |
View main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
@click.command() | |
def main(): | |
pass | |
if __name__ == "__main__": | |
main() |
View gist:793837d8f78e4e5d8ce88794dd47fe99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
sent = 'a b c b c c A B C B C C' | |
match = re.search('\w+', sent) | |
while match: | |
word = match.group() | |
sent, count = re.subn(word, '', sent, flags=re.I) | |
match = re.search('\w+', sent) | |
print(word, count) |
View remove_punctuation_py3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import unicodedata | |
table = {c: ' ' for c in range(sys.maxunicode) | |
if unicodedata.category(chr(c)).startswith('P')} | |
def remove_puntuation(s): | |
return s.translate(table) |
View remove_punctuation_py2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import unicodedata | |
table = {c: u' ' for c in range(sys.maxunicode) | |
if unicodedata.category(unichr(c)).startswith('P')} | |
def remove_punctuation(s): | |
return s.translate(table) |
NewerOlder