Source code for multithreading
from PyQt5 import QtCore
import traceback
import sys
[docs]class WorkerThreadSignals(QtCore.QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
finished
No data
error
`tuple` (exctype, value, traceback.format_exc() )
result
`object` data returned from processing, anything
progress
`int` indicating % progress
'''
finished = QtCore.pyqtSignal()
js_callback = QtCore.pyqtSignal(str, str, str)
homepage_end = QtCore.pyqtSignal()
homepage_start = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(tuple)
result = QtCore.pyqtSignal(object)
progress = QtCore.pyqtSignal(int)
add_table_item = QtCore.pyqtSignal(int, int, object)
update_table_item = QtCore.pyqtSignal(int, int, str)
start_table = QtCore.pyqtSignal(int, int, list)
end_table = QtCore.pyqtSignal()
update_track_progress = QtCore.pyqtSignal(float)
track_finished = QtCore.pyqtSignal()
update_track_duration = QtCore.pyqtSignal(int)
scrobble_track = QtCore.pyqtSignal()
[docs]class WorkerThread(QtCore.QRunnable):
'''
A class for defining a worker thread.
We inherit properties from QRunnable to in order to handle operations such as thread setup, signals and wrap-up.
We sub-class worker from QtCore.QRunnable, in order to gain access to various public function we will require.
'''
def __init__(self, function, *args, **kwargs):
'''
A constructor for creating a new worker thread
The constuctor for the Worker class primarily sets up signals for this particular worker, which will be
required during process or if an error occurs.
Parameters
----------
self : instance
Class instance.
fn : function
The function to be executed within the worker.
args : list
A list of arguments.
kwargs : list
A list of keyword arguments.
'''
super(WorkerThread, self).__init__()
# Store constructor arguments as instance variables for later retrieval and use
self.func = function
self.arguments = args
self.k_arguments = kwargs
self.qt_signals = WorkerThreadSignals()
# Add the callback to our kwargs
kwargs['js_callback'] = self.qt_signals.js_callback
kwargs['homepage_end'] = self.qt_signals.homepage_end
kwargs['homepage_start'] = self.qt_signals.homepage_start
kwargs['add_table_item'] = self.qt_signals.add_table_item
kwargs['update_table_item'] = self.qt_signals.update_table_item
kwargs['start_table_callback'] = self.qt_signals.start_table
kwargs['fin_table_callback'] = self.qt_signals.end_table
kwargs['track_finished'] = self.qt_signals.track_finished
kwargs['update_track_progress'] = self.qt_signals.update_track_progress
kwargs['update_track_duration'] = self.qt_signals.update_track_duration
kwargs['scrobble_track'] = self.qt_signals.scrobble_track
[docs] @QtCore.pyqtSlot()
def run(self):
'''
Begins thread execution
Retrieve the arguments and keyword arguments 'kwargs' and use them to start processing, sending signals when
required
Parameters
----------
self : instance
Class instance.
'''
# Try executing the thread
try:
thread_returned_value = self.func(*self.arguments, **self.k_arguments)
except:
# Print the traceback of the error that occured
traceback.print_exc()
executionType, errorValue = sys.exc_info()[:2]
# Emit the error so that main program is made aware
self.qt_signals.error.emit((executionType, errorValue, traceback.format_exc()))
else:
# Return the result of the processing
self.qt_signals.result.emit(thread_returned_value)
finally:
# Tell main program that this thread has finished
self.qt_signals.finished.emit()


#include <string.h>
#include <stdlib.h>
Functions | |
| char * | pl_cpy (char *source, char *destination) |
| This function is a wrapper around strcpy, it copies a string into a buffer. If the destination argument is NULL a new buffer is allocated, and if it is not NULL the string passed in source is copied into the destination buffer. More... | |
| char * | pl_slice (char *source, int offset, int limit) |
| This function slices an string using an offset and a limit and returns a substring. The original string is not manipulated in any way. The function supports the use of both a negative offset and limit. When using a negative value it is offsetted from the end of the string. More... | |
| char * | pl_cat (char *destination, char *source) |
| This function creates a new buffer that is the size of the two arguments, and both arguments are copied into it. The resulting string is destination+source. More... | |
| char ** | pl_split (char *string, char *delim, int *size) |
| This function splits the string using a delimiter, and puts the results in array of strings. The function differs from the behaviour of strtok, if the delimiter is longer than a single character it splits the string where where the delimiter is found. If the string is "fooasdbarasdmagic" and the delimiter is "asd" the result will be ["foo", "bar", "magic"]. If the delimiter is not found, or it is empty string NULL is returned instead. The original string is not modified. More... | |
| int | pl_startswith (char *string, char *prefix) |
| Checks if the string starts with a prefix. Does not modify the string. More... | |
| int | pl_endswith (char *string, char *postfix) |
| Checks if a strings ends with a postfix. The function does not alter the string. More... | |
| char * | pl_strip (char *string, char *chars) |
| This function strips characters from a string. The default behaviour if chars is NULL or empty string is to strip whitespace characters from either end of the string. The characters removed is '\n \r \t \v \f' and the space character. If the chars parameter contains characters those characters are removed from either side of the string. More... | |
| char * | pl_translate (char *string, unsigned char *table, char *deletechars) |
| This function implements the behaviour of python string translate method. This function has two different behaviours. It either deletes characters from the string, or switches out the characters with the ones set in the table. More... | |
| char ** | pl_splitlines (char *the_string, int keepends, int *size) |
| This function splits up a string when a newline character is found. More... | |
| int | pl_count (char *the_string, char *word) |
| Counts the number of occurences of a word in a string. The word can does not need to be a word in the english langauge sense, just any form of sub string can be counted. More... | |
| char * | pl_expandtabs (char *the_string, int tabsize) |
| This function replaces tabs with spaces. More... | |
| char* pl_cat | ( | char * | destination, |
| char * | source | ||
| ) |
This function creates a new buffer that is the size of the two arguments, and both arguments are copied into it. The resulting string is destination+source.
You need to free the returned buffer after use.
| destination | The first string you want to concatenation to. |
| source | The string you want concatenation destination with. |
Example
Output
| int pl_count | ( | char * | the_string, |
| char * | word | ||
| ) |
Counts the number of occurences of a word in a string. The word can does not need to be a word in the english langauge sense, just any form of sub string can be counted.
| the_string | The string you wnat to search. |
| word | The sub string you want to search the string for. |
Example
Output
| char* pl_cpy | ( | char * | source, |
| char * | destination | ||
| ) |
This function is a wrapper around strcpy, it copies a string into a buffer. If the destination argument is NULL a new buffer is allocated, and if it is not NULL the string passed in source is copied into the destination buffer.
If the source parameter is NULL you will need to free the returned buffer after use.
| source | This is string you want to copy into the buffer. |
| destination | This is the optional destination buffer, if NULL is passed a new buffer is allocated and the source is copied into it. If it is not NULL the source will be copied into the destination buffer. |
Example
Output
| int pl_endswith | ( | char * | string, |
| char * | postfix | ||
| ) |
Checks if a strings ends with a postfix. The function does not alter the string.
| string | The string you want to check if ends with the postfix. |
| postfix | The substring you want to check if the string ends with. |
Example
Output
| char* pl_expandtabs | ( | char * | the_string, |
| int | tabsize | ||
| ) |
This function replaces tabs with spaces.
The tabs are replaced with spaces ' ' up to the next column. The column width is specified by the tabsize parameter, and the number of spaces inserted for each tab is the number of spaces needed to reach the next multiple of tabsize. The returned string is allocated on the heap, remember to free this resource after use. NULL is returned in the follwoing cases: The passed string points to NULL. tabsize has a negative value. Or the string has a length of zero.
| the_string | The string with tabs. |
| tabsize | The width of the column. |
Example
Output
| char* pl_slice | ( | char * | source, |
| int | offset, | ||
| int | limit | ||
| ) |
This function slices an string using an offset and a limit and returns a substring. The original string is not manipulated in any way. The function supports the use of both a negative offset and limit. When using a negative value it is offsetted from the end of the string.
You need to free the returned buffer after use.
| source | The string you want to slice. |
| offset | The offset you want to slice from. |
| limit | The limit you want to slice too. |
Example
Output
| char** pl_split | ( | char * | string, |
| char * | delim, | ||
| int * | size | ||
| ) |
This function splits the string using a delimiter, and puts the results in array of strings. The function differs from the behaviour of strtok, if the delimiter is longer than a single character it splits the string where where the delimiter is found. If the string is "fooasdbarasdmagic" and the delimiter is "asd" the result will be ["foo", "bar", "magic"]. If the delimiter is not found, or it is empty string NULL is returned instead. The original string is not modified.
You need to free the returned buffer after use, remember to iterate over the returned buffer and free every element in it before you free the returned buffer.
| string | The string you want to split up. |
| delim | The delimiter you want to use. |
| size | This will be set to the size of the returned array. |
Example
Output
| char** pl_splitlines | ( | char * | the_string, |
| int | keepends, | ||
| int * | size | ||
| ) |
This function splits up a string when a newline character is found.
The function is very similar to the split function but the results are a bit different. It splits up a string whenever it finds the \n or \r character. If the keepends parameter is set the function will not remove the newline from the string.
If the string "first\nsecond\n\nfourth" is passed the results will be: ["first", "second", "", "fourth"] . If the keepends parameter is set the results of the same string would be: ["first\n", "second\n", "\n", "fourth\n"]
This function allocates memory, the returned pointer should be freed after use.
| the_string | The string you want to split. |
| keepends | If set to 1 the newlines will be appended, if not the will be removed. |
| size | This parameter will be changed to the size of the returned string array. |
Example
Output
| int pl_startswith | ( | char * | string, |
| char * | prefix | ||
| ) |
Checks if the string starts with a prefix. Does not modify the string.
| string | The string you want to check. |
| prefix | The substring you want to check if the string starts with. |
Output
| char* pl_strip | ( | char * | string, |
| char * | chars | ||
| ) |
This function strips characters from a string. The default behaviour if chars is NULL or empty string is to strip whitespace characters from either end of the string. The characters removed is '\n \r \t \v \f' and the space character. If the chars parameter contains characters those characters are removed from either side of the string.
You need to free the returned buffer after use.
| string | The string you want to split. |
| chars | The characters you want to strip from the string. If the parameter is empty or NULL whitespace is removed from either side. |
Example
Output
| char* pl_translate | ( | char * | string, |
| unsigned char * | table, | ||
| char * | deletechars | ||
| ) |
This function implements the behaviour of python string translate method. This function has two different behaviours. It either deletes characters from the string, or switches out the characters with the ones set in the table.
If the table parameter, is NULL the characters passed in the deletechars parameter are removed from the string. If you pass it the string 'read this short text', and deletechars is 'aeiou', the returned string is 'rd ths shrt txt'.
If the table parameter is not empty, every occurrence of one of the table characters is replaced with the character in deletechars at the same index. So if the same string is passed 'read this short text', and the table is 'xxxxx', and deletechars is 'aeiou' the returned string is 'rxxd thxs shxrt txxt'. The length of the table and deletechars needs to be of the same length, or else the function will return NULL.
You need to free the returned buffer after use.
| string | The string you want to translate. |
| table | Optional parameter, if set it is used to swap the characters passed in the deletechars parameter. If not every occurrence of the characters passed in deletechars is removed from the string. |
| deletechars | The characters in the parameter is removed or swapped out from the string. If the table parameter is used this parameter and table needs to be of equal size. |
Example
Output


MAP WIDGET
The TM Widgets allow partners to setup particular widgets and provide enhanced discovery experience for consumers within copy/paste distance.
Widget: Keyword search
You can use the widget configurator below to customize the layout of the widget, and grab a small code snippet to insert into your website.


Hangman
Guess the name of the Disney movie
Click any letter to begin...


Before Change
include a constant or trend. If provided, these variables are
used as additional features in the regression operation.
y = check_array(y, ensure_2d=False, force_all_finite=False, copy=True, dtype=DTYPE)
// if exog was included, check the array...
if exogenous is not None:
exogenous = check_array(exogenous, ensure_2d=True, force_all_finite=False,
After Change
include a constant or trend. If provided, these variables are
used as additional features in the regression operation.
y = column_or_1d(check_array(y, ensure_2d=False, force_all_finite=False, copy=True, dtype=DTYPE))
n_samples = y.shape[0]
// if exog was included, check the array...
if exogenous is not None:
exogenous = check_array(exogenous, ensure_2d=True, force_all_finite=False,


Lauren
This is Lauren's first year competing in robotics competitions. She is looking forward to learning more about coding & building robots. She has been known to say "I really love science.”
Ryan
Ryan is an avid Swimmer and is intrested in technology. He joined 56F before last competition and has been helping us with everything from code to building to scouting and marketing.
Cully
Cully was first introduced to robotics in 5th grade during Lego Robotics. Continuing a Lifelong fascination with the way things work. He got his start formally learning vex in 7th grade in the “Intro to vex” course after school. When he was in 8th grade, Cully got an opportunity to join the high school robotics team and he and his team were chosen to go to states. Outside of school, Cully designs and builds electronic circuits and is well versed in embedded programming and is an avid sailor of ships and dinghys of all sizes. Cully will be studying electrical engineering in college next year.
Matt
Matt first became involved with the Cape Elizabeth Vex Robotics program with the Maine worlds team last year. Matt is an avid swimmer and has intrests in many areas of robotics. He can usually be found saying "Clean up our workspace" to Cully or working on the robot.


Bodybuilding gran, 82, stops intruder by smashing table over him
An 82-year-old bodybuilder described the moment she ‘went to work’ on an intruder who broke into her home.
Willie Murphy was getting ready for bed late on Thursday night when the man started banging at her door begging she call an ambulance.
The man then forced his way inside when she refused to open up.

Advertisement Advertisement
She later told Fox News : ‘I went to work on him. The table broke.
‘And when he’s down. I’m jumping on him. I grabbed the shampoo. Guess what? He’s still on the ground. In his face, all of it, the whole thing.’
Willie said of the incident: ‘I’m alone and I’m old, but guess what? I’m tough.’
She was already something of a local celebrity due to her impressive one-handed pull-ups, fingertip push-ups and running sprint races against young children, MailOnline reported.
Willie also described how some of the emergency services dispatched to the scene asked for selfies before she later received a hero’s welcome on her return to the Maplewood YMCA.
‘He picked the wrong house to break into,’ Willie said.
Got a story for Metro.co.uk?
Get in touch with our news team by emailing us at<EMAIL_ADDRESS>For more stories like this, check our news page.


|
Systolic Simulator
A simulation of systolic algorithmic flow in C++
|
Cell container and runner. More...
#include <Container.hpp>
Public Member Functions | |
| Container (const std::initializer_list< const int > entries) | |
| Default constructor. More... | |
| Container (const std::queue< int > entries) | |
| Preset constructor. More... | |
| Container (const int entries,...) | |
| C-Style constructor. More... | |
| void | addCell (std::unique_ptr< Systolic::Cell::ICell > cell) |
| Add a new cell. More... | |
| void | setCells (std::vector< std::unique_ptr< Systolic::Cell::ICell >> cells) |
| Initialize cells. More... | |
| void | setCells (std::shared_ptr< Systolic::CellArrayBuilder > builder) |
| Initialize cells. More... | |
| void | step () |
| Single tick on the operation chain. More... | |
| void | compute () |
| Operate the chain until completion. More... | |
| void | dumpOutputs () const |
| Display the current content of the output queue. More... | |
| std::queue< int > | getOutputs () const |
| Get a copy of the current output queue, as a list of no-space comma-separated numbers. | |
| std::string | getCurrentStateLog () const |
| Get a textual representation of the current state. More... | |
| std::string | getLog () const |
| Get a textual representation of past and current states. More... | |
Cell container and runner.
Container made to received a user-defined collection of cell and to run that collection in a systolic manner over a given input list.
| Systolic::Container::Container | ( | const std::initializer_list< const int > | entries | ) |
Default constructor.
| entries | List of the number to process as a bracket-enclosed list (e.g. {0, 1, 2, 3}). |
| Systolic::Container::Container | ( | const std::queue< int > | entries | ) |
Preset constructor.
| entries | A preset queue of the numbers to process. |
| Systolic::Container::Container | ( | const int | entries, |
| ... | |||
| ) |
C-Style constructor.
Tells how many inputs there is and what is their respective value. Using a greater index than the actual number of entries result in undefined behaviour.
| entries | Number of entries to process from the list. |
| ... | Variable number of input. |
| void Systolic::Container::addCell | ( | std::unique_ptr< Systolic::Cell::ICell > | cell | ) |
Add a new cell.
Add a new cell at the end of the operation chain. Call is ignored if the cell is a null value. Call is also ignored if the cell is already present in the operation chain.
| cell | An instance of an ICell derivative. |
| void Systolic::Container::compute | ( | ) |
Operate the chain until completion.
Make the operation chain work until every inputs have been send to the outputs queue. Call is ignored if no cell are registered. Call is also ignore if no inputs are registered.
| void Systolic::Container::dumpOutputs | ( | ) | const |
Display the current content of the output queue.
Displays all values contained within the output queue on the standard output, in a First In, First Out manner.
| std::string Systolic::Container::getCurrentStateLog | ( | ) | const |
Get a textual representation of the current state.
Get a string visually representing the current state of the board, its cells and input/output.
| std::string Systolic::Container::getLog | ( | ) | const |
Get a textual representation of past and current states.
Get a string visually representing the cells' content and the container input/output for past states as well as the current one,
| void Systolic::Container::setCells | ( | std::vector< std::unique_ptr< Systolic::Cell::ICell >> | cells | ) |
Initialize cells.
Initializes all the cells from the given vector. The vector is moved and so becomes invalid after a call to this function.
| cells | Vector with all cell to use in order. |
| void Systolic::Container::setCells | ( | std::shared_ptr< Systolic::CellArrayBuilder > | builder | ) |
Initialize cells.
Initializes all the cells with the current instance of the builder.
| builder | CellArrayBuilder. |
| std::invalid_argument | if builder is null. |
| void Systolic::Container::step | ( | ) |
Single tick on the operation chain.
Provoke each registered cell to compute their current value and aquire their next input. Call is ignored if not cell are registered.


| 1 | package fr.sii.ogham.email.sendgrid.v2.sender.impl.sendgrid.handler; | |
| 2 | ||
| 3 | import com.sendgrid.SendGrid; | |
| 4 | ||
| 5 | import fr.sii.ogham.core.message.content.Content; | |
| 6 | import fr.sii.ogham.core.message.content.MultiContent; | |
| 7 | import fr.sii.ogham.email.exception.sendgrid.ContentHandlerException; | |
| 8 | import fr.sii.ogham.email.message.Email; | |
| 9 | ||
| 10 | /** | |
| 11 | * Content handler for {@link MultiContent} instances. All it does is, for each | |
| 12 | * content contained within the instance, it delegates processing to an injected | |
| 13 | * content handler. | |
| 14 | * | |
| 15 | */ | |
| 16 | public final class MultiContentHandler implements SendGridContentHandler { | |
| 17 | ||
| 18 | private final SendGridContentHandler delegate; | |
| 19 | ||
| 20 | /** | |
| 21 | * Constructor. | |
| 22 | * | |
| 23 | * @param delegate | |
| 24 | * the underlying content handler to delegate processing of each | |
| 25 | * of the contents contained within a {@link MultiContent} | |
| 26 | * instance | |
| 27 | */ | |
| 28 | public MultiContentHandler(final SendGridContentHandler delegate) { | |
| 29 | if (delegate == null) { | |
| 30 | throw new IllegalArgumentException("[delegate] cannot be null"); | |
| 31 | } | |
| 32 | ||
| 33 | this.delegate = delegate; | |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Reads the content and adds it into the email. This method is expected to | |
| 38 | * update the content of the {@code email} parameter. | |
| 39 | * | |
| 40 | * While the method signature accepts any {@link Content} instance as | |
| 41 | * parameter, the method will fail if anything other than a | |
| 42 | * {@link MultiContent} is provided. | |
| 43 | * | |
| 44 | * @param email | |
| 45 | * the email to put the content in | |
| 46 | * @param content | |
| 47 | * the unprocessed content | |
| 48 | * @throws ContentHandlerException | |
| 49 | * the handler is unable to add the content to the email | |
| 50 | * @throws IllegalArgumentException | |
| 51 | * the content provided is not of the right type | |
| 52 | */ | |
| 53 | @Override | |
| 54 | public void setContent(final Email original, final SendGrid.Email email, final Content content) throws ContentHandlerException { | |
| 55 |
2
1. setContent : All method instructions removed → NO_COVERAGE 2. setContent : All method instructions removed → KILLED |
if (email == null) { |
| 56 | throw new IllegalArgumentException("[email] cannot be null"); | |
| 57 | } | |
| 58 | if (content == null) { | |
| 59 | throw new IllegalArgumentException("[content] cannot be null"); | |
| 60 | } | |
| 61 | ||
| 62 | if (content instanceof MultiContent) { | |
| 63 | for (Content subContent : ((MultiContent) content).getContents()) { | |
| 64 | delegate.setContent(original, email, subContent); | |
| 65 | } | |
| 66 | } else { | |
| 67 | throw new IllegalArgumentException("This instance can only work with MultiContent instances, but was passed " + content.getClass().getSimpleName()); | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | } | |
Mutations | ||
| 55 |
1.1 2.2 |


Collection
The funding system and rates that the Skills Funding Agency has used to approve qualifications for public funding.
Details of the funding system used for apprenticeship frameworks and standards from 1 May 2017.
Published: 11 March 2014
Updated: 15 March 2017
From: Skills Funding Agency
Part of: Further education and training


Newbie Guide:
Select the one you seek below. Their location will be indicated on the radar.
Praetorian Rukain
Centurion Nakusin
Centurion Tamai
Centurion Parugon
Centurion Orinak
Centurion Tiku
Centurion Petukai
Centurion Vapook
Back To The Main List


This project was created for Computational Geometry course conducted by Ph.D. Barbara Głut at AGH University of Science and Technology.
The project was first presented in the classroom. Here is a link to the the slides (in polish language): http://slid.es/mequrel/kddrzewa
Application was created as a webapp in order to be accessible and useful to anyone. I used generic web application skeleton provided by "yo" app generator. The functional code is placed in scripts/ directory and divided on 5 modules:
Algorithm history visualization is implemented using the idea of execution log. Each algorithm has injected special service called describer. Using this service algorithm is able to describe each step both textually and graphically. Here's an example taken from search function performing range query:
describer.nextStep()
.write("Finished recursion for left/up part.")
.setCurrentNode(kdTree)
.highlightRange(kdTree.left.range);
Using describer algorithm can merge many describing request in one step.
Fluent syntax interface of the describer helps with code readability.
Code of this application along with its documentation is published on GitHub with BSD license. Feel free to fork or contribute. I would appreciate if you let me know that this app was useful for you.
GitHub link: http://github.com/mequrel/kd-tree-visualization
I took big advantage by using d3.js library along with their brilliant examples. Two of those examples: Collapsible tree layout and Quadtree were adapted to visualize kd-tree algorithms. Thanks mbostock!
Application was created using yeoman workflow. As previously described app skeleton was generated using yo tool. The app was compiled, minified and deployed using grunt. Besides d3.js also jQuery and highlight.js were used.
References that really helped me:


Revolutionising Smart Clothing
Hello. We are ADAM & AOKI, a technology company dedicated to developing next generation smart clothing. We go beyond being a brand. We are a movement revolutionising the interactions between people and everyday wear.
Hello. We are ADAM & AOKI, a technology company dedicated to developing next generation smart clothing. We go beyond being a brand. We are a movement revolutionising the interactions between people and everyday wear.
We are happy to announce the first software update to our smart shirt!
With this update, you are now able to choose the color your smart shirt changes to when you are in danger of being sunburnt.
Introducing the smart shirt!
We are ready to unveil the smart shirt to the world!
The Smart Shirt is a product unlike any other. It combines modern technogological advancements together with the latest fashion trends to create something that is both functional and stylish.
Using our inhouse designed Smart Cloth, we are able to communicate with the weather when they are in danger of being sunburnt, by actively changing the color of the Smart Shirt itself.
Furthermore, with our app, we can actively notify you of the current status of the Smart Shirt, and how much longer you have until in danger of being sunburnt.
We are ADAM & AOKI,
One of the first companies to confront functional clothing.
We are proud to represent what the future of smart clothing will look like.
Using innovative technologies together with the latest fashion trends, we create products that are both functional to the wearer, but also reflect the modern fashion trends.
Our first product, the The Smart Shirt is able to warn you when you are in danger of being sunburnt.
We managed to achieve this using our signature Smart Fabric which changes color under specific conditions.
Combined with the color changing smart fabric, we have our SmartShirt App, which notifies you when you have spent too much time in the sun, without proper protection.
This is what we have managed to achieve thus far, and we are looking forward to doing more good in the future!
We believe that together, we can create truly functional and stylish clothing!
Feel free to shout at us by filling out the contact form or visiting our social network sites.
Social Media


Thanks for using me!
Feel free to use this boilerplate and modify it. Not sure what is this? Learn it here.
Any bug / suggestion / feedback you might have, please let me know. I'd really appreciate it!
If you don't have anything to say at all, well... have fun!


a
little
about me
Hi! My name is Thao and I'm a 4th year Cognitive Science design student at UCSD. My inspiration for creating comes from the world around me. I love designing and programming to offer practical and unique solutions to problems in order to improve the way we live with technology. When I'm not at my computer, you can find me at a dessert shop or restaurant that I found on Yelp, cooking at home, or exploring San Diego!


# -*- coding:utf-8 -*- '''Unit tests for allos/applications module''' from sikuli import * import os, sys, unittest, datetime, HTMLTestRunner # find path of [ROOT]/allos folder allos_path = this_path = getBundlePath() for i in range(3): allos_path = os.path.dirname(allos_path) allos_path = os.path.join(allos_path, "allos") # add it to path if not allos_path in sys.path: sys.path.append(allos_path) # import applications module import applications, path_utils class ApplicationsTestCase(unittest.TestCase): def testLaunchChromeWithoutWaiting(self): applications.launch_app("google chrome", wait_img=False, timeout=10) def testLaunchChromeAndWait(self): applications.launch_app("google chrome", wait_img=True, timeout=10) tests = unittest.TestLoader().loadTestsFromTestCase(ApplicationsTestCase) out_folder = os.path.join( path_utils.get_ws_root_path(), "out", "test_reports", "allos", "applications_tests" ) now = datetime.datetime.now() filename = "{}-{}-{}.{}h{}.html".format( now.year, now.month, now.day, now.hour, now.minute ) with open(os.path.join(out_folder, filename), 'w') as rf: runner = HTMLTestRunner.HTMLTestRunner( stream = rf ) runner.run(tests)


{% extends base-layout.html %} {% block content %}
This is where various things will live, such as being able to delete, edit, or make a new post to a personal blog, add an entry to the adventure page.


Welcome to Reappt Chat
Connection Status:
Disconnected
Host:
Port:
Username:
Password:
Create new user:
With password:
Confirm password:
Chat with:
Add as friend:
Friends
Chat Groups


The Belt method has been 'invented' many times before, and it is generally accepted to be a bad method.
Here is my attempt at a belt method that is better than the normal belt method.
The first step is, obviously, to create a belt along the E slice. This usually takes around 6 moves.
The second step is to orient all the corners in one algorithm. There are around 150 cases for this step, and it averages about 11 moves, including U and D setup moves.
The third step is to position all the corners in one algorithm. There are around 200 cases for this step, and it averages about 12 moves, including U and D setup moves. Many of the algorithms use only R2, U, and D moves, especially the shorter ones. In fact, five cases are only three moves long! After completing this step, there will only be 8 edges left to solve.
The fourth step is to position the DL and DR edges intuitively. This averages about 5 moves. After this step, the cube can be solved with only M and U moves.
The final step is to solve the last 6 edges like in Roux. This averages about 15 moves.
Total: About 350 algorithms and 49 moves on average. Recognition for the algorithmic steps is pretty bad, so I don't think this method would be viable. At least it's better than the normal belt method.


Bullet Collision Detection & Physics Library
src
BulletDynamics
Vehicle
Vehicle Directory Reference
Directory dependency graph for Vehicle:
Files
file
btRaycastVehicle.cpp
[code]
file
btRaycastVehicle.h
[code]
file
btVehicleRaycaster.h
[code]
file
btWheelInfo.cpp
[code]
file
btWheelInfo.h
[code]
Generated by
1.8.13


Yeah but what sort of transactional semantics does it provide? 8/13/2017, 11:48:57 AM Favs: 5 Retweets: 0 link


The majority of your bootcamp will be devoted to working on "hard" skills such as learning how to code, version control, and managing deployments. The professional and personal development portion of the bootcamp will be quite different. It will be a deep dive into building confidence and understanding on who you are as a software developer. This will be a little different than traditional career counseling. You will identify what your goals are as a developer and how you are going to achieve them. In the local tech industry, "soft" or "people" skills are highly valued, employers are hiring for "aptitude and attitude" more so than raw technical capacity. They are fundamental to your success. They will require a lot of introspection and willingness to get out of your comfort zone for certain activities such as public speaking, networking, and team building. The pace and structure of the professional development process will be very different than the main curriculum used to teach the coding lessons. In this immersive training environment, please remember to be agile, prioritize collaboration, iterate to success, and always take time to reflect on what you are learning from the entire experience.
Here are some people that are here to support you during and after the bootcamp.
 Who is someone that hold you accountable?
Who is your mentor? Who is someone that listen to you and provide ideas on your next step?
For assistance with anything job related, feel free to utilize CNM's Job Connection Services located on Main Campus in the Student Services Building
Full-time bootcamps will have core professional development modules that will be conducted during the work week.
Every Week (generally on Friday afternoons) is pro dev Lab time for all participants of Deep Dive Coding. Lab time can range from 1-3 hours depending on the activities that week. Some examples of activities are workshops, guest speakers, presentations, pitch practice, team building exercises, employer interviews, "Back to Basic" programming and other industry related events. Weekly schedule will be posted in Slack under the #pro-dev-lab channel.
Weekly evening talks from instructors and other senior developers on various technology and programming.
Physical exercises and team building activities with your cohort.
In addition to cohort specific activities, there will be occasional fieldtrips for all current Deep Dive Coding participants. They may include a visit to a local employer, business networking event, Demo Day, alumni events, etc. You will be informed via Slack about these as they are coming up.
Participation in all professional development acitivies is crucial to your cohort's success. They make up a portion of your grade and reflect our capacity to support you during and after the bootcamp. If you do well in professional development, more than likey you will do well in the tech industry.
The professional development portion of the bootcamp is quite different than the main component of learning how to code. Therefore there are additional expectations from your coaches to help you excel in your career.


class GaussFullSampler(GaussSampler):
Multi-variate normal distribution with zero mean.
Provides methods to sample
from and update
a multi-variate
normal distribution with zero mean and full covariance matrix.
>>> import cma, numpy as np >>> g = cma.sampler.GaussFullSampler(np.ones(4)) >>> z = g.sample(1)[0] >>> assert g.norm([1,0,0,0]) == 1 >>> g.update([[1., 0., 0., 0]], [.9]) >>> g.update_now() >>> assert g.norm([1,0,0,0]) == 1 >>> g.update([[4., 0., 0.,0]], [.5]) >>> g.update_now() >>> g *= 2 >>> assert cma.utilities.math.Mh.equals_approximately(g.variances[0], 17) >>> assert cma.utilities.math.Mh.equals_approximately(g.D[-1]**2, 17)
TODO
o Clean up CMAEvolutionStrategy attributes related to sampling (like usage of B, C, D, dC, sigma_vec, these are pretty substantial changes). In particular this should become compatible with any StatisticalModelSampler. Plan: keep B, C, D, dC for the time being as output-info attributes, DONE: keep sigma_vec (55 appearances) as a class.
- o combination of sigma_vec and C:
- update sigma_vec with y (this is wrong: use "z")
- rescale y according to the inverse update of sigma_vec (as if y is expressed in the new sigma_vec while C in the old)
- update C with the "new" y.
| Parameters | |
| dimension | (required) define the dimensionality (attribute dimension) of the normal distribution. If dimension is a vector, it sets the diagonal of the initial covariance matrix. |
| lazy | is the number of iterations to wait between the O(n^3) updates of the sampler. All values <=1 behave identically. |
| constant | 'arithmetic'/'aeigen' or 'geometric' or 'geigen' (geometric mean of eigenvalues) are available to be constant. |
| randn=np | is used to generate N(0,1) numbers. |
| eigenmethod=np | function returning eigenvalues and -vectors of symmetric matrix |
| Method | __imul__ |
sm *= factor is a shortcut for sm = sm.__imul__(factor). |
| Method | __init__ |
declarative init, doesn't need to be executed |
| Method | correlation |
return correlation between variables i and j. |
| Method | inverse |
return scalar correction alpha such that X and f fit to f(x) = (x-mean) (alpha * C)**-1 (x-mean) |
| Method | limit |
bound condition number to limit by adding eps to the trace. |
| Method | multiply_ |
multiply self.C with factor updating internal states. |
| Method | norm |
compute the Mahalanobis norm that is induced by the statistical model / sample distribution, specifically by covariance matrix C. The expected Mahalanobis norm is about sqrt(dimension). |
| Method | reset |
reset distribution while keeping all other parameters. |
| Method | sample |
return list of i.i.d. samples. |
| Method | to |
"re-scale" C to a correlation matrix and return the scaling factors as standard deviations. |
| Method | to |
return associated linear transformation. |
| Method | to |
return inverse of associated linear transformation. |
| Method | transform |
apply linear transformation C**0.5 to x . |
| Method | transform |
apply inverse linear transformation C**-0.5 to x . |
| Method | update |
update/learn by natural gradient ascent. |
| Method | update |
update internal variables for sampling the distribution with the current covariance matrix C. |
| Instance Variable | B |
axis lengths, roots of eigenvalues, sorted |
| Instance Variable | C |
covariance matrix |
| Instance Variable | condition |
Undocumented |
| Instance Variable | constant |
Undocumented |
| Instance Variable | count |
Undocumented |
| Instance Variable | count |
Undocumented |
| Instance Variable | D |
Undocumented |
| Instance Variable | dimension |
Undocumented |
| Instance Variable | eigenmethod |
Undocumented |
| Instance Variable | inverse_root_ |
Undocumented |
| Instance Variable | last |
Undocumented |
| Instance Variable | lazy |
Undocumented |
| Instance Variable | randn |
Undocumented |
| Property | beta |
beta from Algorithm 1 line 16 in https://direct.mit.edu/evco/article/28/3/405/94999/Diagonal-Acceleration-for-Covariance-Matrix |
| Property | condition |
Undocumented |
| Property | corr |
condition number of the correlation matrix |
| Property | correlation |
return correlation matrix of the distribution. |
| Property | covariance |
Undocumented |
| Property | variances |
vector of coordinate-wise (marginal) variances |
| Method | _decompose_ |
eigen-decompose self.C thereby updating self.B and self.D. |
| Method | _sort |
sort columns of B and D according to the values in D |
| Method | _update |
Undocumented |
| Instance Variable | _beta |
Undocumented |
| Instance Variable | _corr |
Undocumented |
| Instance Variable | _corr |
Undocumented |
| Instance Variable | _inverse_root_ |
Undocumented |
Inherited from GaussSampler
:
| Method | set_ |
set Hessian w.r.t. which to compute the eigen spectrum. |
| Method | set_ |
set Hessian from f at x0. |
| Property | chin |
approximation of the expected length when isotropic with variance 1. |
| Property | eigenspectrum |
return eigen spectrum w.r.t. H like sqrt(H) C sqrt(H) |
| Instance Variable | _left |
Undocumented |
| Instance Variable | _right |
Undocumented |
Inherited from StatisticalModelSamplerWithZeroMeanBaseClass
(via GaussSampler
):
| Method | parameters |
return dict with (default) parameters, e.g., c1 and cmu . |
| Instance Variable | _lam |
Undocumented |
| Instance Variable | _mueff |
Undocumented |
| Instance Variable | _parameters |
Undocumented |
sm *= factor is a shortcut for sm = sm.__imul__(factor).
Multiplies the covariance matrix with factor
.
cma.sampler.GaussSampler.__init__
declarative init, doesn't need to be executed
cma.interfaces.StatisticalModelSamplerWithZeroMeanBaseClass.inverse_hessian_scalar_correction
return scalar correction alpha such that X and f fit to f(x) = (x-mean) (alpha * C)**-1 (x-mean)
bound condition number to limit
by adding eps to the trace.
This method only changes the sampling distribution, but not the underlying covariance matrix.
We add eps = (a - limit * b) / (limit - 1) to the diagonal variances, derived from limit = (a + eps) / (b + eps) with a, b = lambda_max, lambda_min.
>>> import cma >>> es = cma.CMAEvolutionStrategy(3 * [1], 1, {'CMA_diagonal_decoding':False, 'verbose':-9}) >>> _ = es.optimize(cma.ff.elli) >>> assert es.sm.condition_number > 1e4 >>> es.sm.limit_condition(1e4 - 1) >>> assert es.sm.condition_number < 1e4
multiply self.C with factor updating internal states.
factor can be a scalar, a vector or a matrix. The vector is used as outer product and multiplied element-wise, i.e., multiply_C(diag(C)**-0.5) generates a correlation matrix.
Details:
compute the Mahalanobis norm that is induced by the statistical model / sample distribution, specifically by covariance matrix C. The expected Mahalanobis norm is about sqrt(dimension).
Example
>>> import cma, numpy as np >>> sm = cma.sampler.GaussFullSampler(np.ones(10)) >>> x = np.random.randn(10) >>> d = sm.norm(x)
d
is the norm "in" the true sample distribution,
sampled points have a typical distance of sqrt(2*sm.dim),
where sm.dim is the dimension, and an expected distance of
close to dim**0.5 to the sample mean zero. In the example,
d
is the Euclidean distance, because C = I.
reset distribution while keeping all other parameters.
If standard_deviations
is not given, np.ones
is used,
which might not be the original initial setting.
return list of i.i.d. samples.
| Parameters | |
| number | is the number of samples. |
| lazy | Undocumented |
| same | Undocumented |
| update | controls a possibly lazy update of the sampler. |
"re-scale" C to a correlation matrix and return the scaling factors as standard deviations.
See also: to_linear_transformation
.
return associated linear transformation.
If B = sm.to_linear_transformation() and z ~ N(0, I), then
np.dot(B, z) ~ Normal(0, sm.C) and sm.C and B have the same
eigenvectors. With reset=True
, np.dot(B, sm.sample(1)[0])
obeys the same distribution after the call.
See also: to_unit_matrix
cma.interfaces.StatisticalModelSamplerWithZeroMeanBaseClass.to_linear_transformation_inverse
return inverse of associated linear transformation.
If B = sm.to_linear_transformation_inverse() and z ~
Normal(0, sm.C), then np.dot(B, z) ~ Normal(0, I) and sm.C and
B have the same eigenvectors. With reset=True
,
also sm.sample(1)[0] ~ Normal(0, I) after the call.
See also: to_unit_matrix
update/learn by natural gradient ascent.
The natural gradient used for the update is:
np.dot(weights * vectors.T, vectors)
and equivalently:
sum([outer(weights[i] * vec, vec) for i, vec in enumerate(vectors)], axis=0)
Details:
- The weights include the learning rate and -1 <= sum(
weights[idx]) <= 1 must be
True
for idx = weights > 0 and for idx = weights < 0. - The content (length) of vectors with negative weights is changed!
update internal variables for sampling the distribution with the current covariance matrix C.
This method is O(dim^3) by calling _decompose_C.
If lazy_update_gap is None the lazy_update_gap from init is taken. If lazy_update_gap < 0 the (possibly expensive) update is done even when the model seems to be up to date.
beta from Algorithm 1 line 16 in https://direct.mit.edu/evco/article/28/3/405/94999/Diagonal-Acceleration-for-Covariance-Matrix


Constructor
new VMBase(config)
Reference Implementation of a View Model Class, for use with vmrLite.js (and optionally requireLite.js)
Documentation :-
See this README.md OR jsdoc on-line here jsdoc VMBase!.
Usage (Inheritance):-
function SampleVM(config) {
if (!(this instanceof SampleVM)) { // If invoked as a factory by mistake
console.debug('SampleVM not called with new');
return new SampleVM(config);
}
if ( !this.className ) this.className = 'SampleVM'
VMBase._init(this, config);
// Listen for events, that affect me, by convention thay are linked to document.body
// (Yes this.container may be null, this is ok, events are registered with addEventListeners on open)
this.eventListeners.push({ elem: document.body, type: 'sampleModelSelected', listener: this.onModelSelected.bind(this) });
// To trigger an event. Use the below or see vmrLite.triggerEvent
this.trigger('sampleModelSelected',{ detail: 'object' } )
}
// Inheritance
SampleVM.prototype = Object.create(VMBase.prototype);
SampleVM.prototype.constructor = SampleVM;
// The class needs to know the __dirname when loaded, for optional content
SampleVM.prototype.loader_dirname = ( __dirname || '');
SampleVM.prototype.template = { // Optional - used to dynamically load the VM partial html.
div: null, // div to clone for container.innerHTML
uri: null, // uri to the html to load and assign to div.
singleton: false, // true only if this is a singleton class. i.e. the template is used once and can be moved around the page
cssUri: null // uri to the css to load to support the div.
};
Parameters:
| Name | Type | Description |
|---|---|---|
config |
object | Configuration options. (See _init) |
Members
(static) version :String
Version of the library
Type:
- String
template :Object
The template to use if defined,
- div - Clone html elements from this div
- uri - load partial html from this uri
- cssUri - load css from this uri
- singleton - true only if the template is used once, (i.e Can be moved around the page, vs cloned)
Type:
- Object
Methods
(protected) _close() → {VMBase}
Close/cleanup. call removeEventListeners, call onCloseCallback, clear 'on' event on container child elements, empty the container (if cloned from template)
Returns:
this
- Type
- VMBase
(protected) _init(config) → {VMBase}
Initalize the base class. Use when inherit.
Parameters:
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | The initial settings for the class. Properties
|
Returns:
this
- Type
- VMBase
(protected) _open(container) → {VMBase}
Open this view (Apply template, and render) in the container specified.
Parameters:
| Name | Type | Description |
|---|---|---|
container |
DOMElement | String | null | The container div (or id of div) |
Returns:
this
- Type
- VMBase
(protected) addEventListeners() → {VMBase}
binds the eventListeners, (i.e. calls addEventListener for each element of eventListeners array),
Only adds listensers if not already listening
If "elem" is null, assumes this is this.container, this you can add items to the eventListeners Array before the container is defined.
Returns:
this
- Type
- VMBase
close() → {VMBase}
Close/cleanup. Base implementation calls _close
Inherit and Override/Overload for use. i.e
- Do you own clean up
- Call this._close()
Returns:
this
- Type
- VMBase
defer_render() → {VMBase}
Queue a render in ~10ms.
If a render is already pending, no operation is performed. This is the preferred way to render, as it is not always clear in a app, if a later action will perform a render.
If immediate feed-back is required use render();
Returns:
this
- Type
- VMBase
hide() → {VMBase}
Hide the container
Set this.container.style.display to 'none'
Returns:
this
- Type
- VMBase
(protected) onChange(ev)
Generic onChange handler, simply sets this.changed=true, The base class listens for 'change' events via onChange.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
DOM-Event | Event triggered |
(protected) onClickClose(ev)
Generic onClickClose handler, User has clicked a button, to request the window closed, base implementation simply calls close();
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
DOM-Event | Event triggered |
open() → {VMBase}
Open this view in the container. Base implementation just calls _open
Inherit and Override/Overload for use. i.e
- Create container if needed.
- Add eventListeners
- Call this._open()
Returns:
this
- Type
- VMBase
(protected) removeEventListeners() → {VMBase}
Unbind the eventListeners when close, It is IMPORTANT to removeEventListener so the object has NO external references from say a dom elements, so it can be garbage collected.
Calls removeEventListener for each element of eventListeners that is listening.
Returns:
this
- Type
- VMBase
render() → {VMBase}
Render the contents in the container.
Simply a wrapper for vmrLite.render where the container is this.container.
Returns:
this
- Type
- VMBase
show() → {VMBase}
Show the container
Clear this.container.style.display
Returns:
this
- Type
- VMBase
sync() → {VMBase}
Sync inputs -> object
Simply a wrapper for vmrLite.sync where the container is this.container.
Returns:
this
- Type
- VMBase
trigger(etype, detail) → {VMBase}
Trigger an custom event. Simply a wrapper for vmrLite.triggerEvent where the container is this.container.
Parameters:
| Name | Type | Description |
|---|---|---|
etype |
String | event type to trigger. (e.g. 'click' ) |
detail |
Object | Object to pass to the event, (available within the event as detail (e.g ev.detail)) |
Returns:
this
- Type
- VMBase


See you in August, {{ guest.first_name }}
Let's take a minute and verify everything is correct. Check the details below and click here if you need to start over.
-
{% if guest.attending == False %}
- Your party will not be attending the wedding. {% else %}
- Your party will be attending the wedding. {% endif %}
- Your party contains these guests:
- {{ member }} {% endfor %}
- We have you down for the following events:
- {{ event }} {% endfor %}
-
{% for member in members %}
-
{% for event in events %}
Finally, we have you staying at {{ guest.hotel }}
Need to make a change? Use your browser's back button to go back a page.
All Correct? Click here!


ConVoice: Real-Time Zero-Shot Voice Style Transfer
Voice Conversion Challenge 2018
The following samples are generated by ConVoice model. Some of them are produced in zero-shot setting, when the model hasn't seen a target or source speaker before, and some of them are synthesized using the model fine-tuned on the Voice Conversion Challenge 2018 training dataset, where each speaker has about 5 minutes of audio.
| Source Speech | Target Speaker | Conversion | |||
|---|---|---|---|---|---|
| VCC2SF1 (Female) | VCC2TF1 (Female) | Zero-Shot | |||
| Fine-tuned | |||||
| VCC2TM1 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TF2 (Female) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TM2 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2SM1 (Male) | VCC2TF1 (Female) | Zero-Shot | |||
| Fine-tuned | |||||
| VCC2TM1 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TF2 (Female) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TM2 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2SF3 (Female) | VCC2TF1 (Female) | Zero-Shot | |||
| Fine-tuned | |||||
| VCC2TM1 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TF2 (Female) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TM2 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2SM3 (Male) | VCC2TF1 (Female) | Zero-Shot | |||
| Fine-tuned | |||||
| VCC2TM1 (Male) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TF2 (Female) | Zero-Shot | ||||
| Fine-tuned | |||||
| VCC2TM2 (Male) | Zero-Shot | ||||
| Fine-tuned |
LibriTTS
Our decoder was trained on "train-clean-100" and "train-clean-360" sets of the LibriTTS dataset. But here we present a few samples that were generated using random source and target audio from the "test" set, that the model hasn't ever seen before.
| Source Speech | Target Speaker | Conversion | |||
|---|---|---|---|---|---|
| 4507 (Female) | 8224 (Male) | Zero-Shot | |||
| 8230 (Male) | 1580 (Female) | Zero-Shot | |||
| 7729 (Male) | 8455 (Male) | Zero-Shot | |||
| 8463 (Female) | 3570 (Female) | Zero-Shot |


logic bomb
`Prev `__
L
`Next `__
--------------
**logic bomb**: n.
Code surreptitiously inserted into an application or OS that causes it
to perform some destructive or security-compromising activity whenever
specified conditions are met. Compare `*back
door* <../B/back-door.html>`__.
--------------
+------------------------------+----------------------------+----------------------------+
| `Prev `__ | `Up <../L.html>`__ | `Next `__ |
+------------------------------+----------------------------+----------------------------+
| locked up | `Home <../index.html>`__ | logical |
+------------------------------+----------------------------+----------------------------+


class: center, middle, inverse, title-slide # R in Power BI ## SQL Saturday #759 ### Taras Kaduk ### 2018/05/05 --- # Agenda - What is R - R inside Power BI - Why do you even need it? # Slides and stuff ## [https://github.com/taraskaduk/r-in-power-bi](https://github.com/taraskaduk/r-in-power-bi) --- # ~~What is love?~~ What is R? ## More importantly, what can it do? - data transform - stat analysis - machine learning / predictive modeling - web apps - reports, presentations - websites & books --- # What can R do? ## Data transformation ```r head(iris) ``` ``` ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3.0 1.4 0.2 setosa ## 3 4.7 3.2 1.3 0.2 setosa ## 4 4.6 3.1 1.5 0.2 setosa ## 5 5.0 3.6 1.4 0.2 setosa ## 6 5.4 3.9 1.7 0.4 setosa ``` --- # What can R do? ## Data transformation ```r iris_gather <- iris %>% gather("key", "size", -Species) head(iris_gather) ``` ``` ## Species key size ## 1 setosa Sepal.Length 5.1 ## 2 setosa Sepal.Length 4.9 ## 3 setosa Sepal.Length 4.7 ## 4 setosa Sepal.Length 4.6 ## 5 setosa Sepal.Length 5.0 ## 6 setosa Sepal.Length 5.4 ``` --- # What can R do? ## Data transformation ```r iris_gather2 <- iris_gather %>% separate(col = key, into = c('part', 'dimension')) head(iris_gather2) ``` ``` ## Species part dimension size ## 1 setosa Sepal Length 5.1 ## 2 setosa Sepal Length 4.9 ## 3 setosa Sepal Length 4.7 ## 4 setosa Sepal Length 4.6 ## 5 setosa Sepal Length 5.0 ## 6 setosa Sepal Length 5.4 ``` --- # What can R do? ## Data transformation ```r iris_summary <- iris_gather2 %>% group_by(Species) %>% summarise(size_avg = mean(size), size_sd = sd(size), size_med = median(size)) head(iris_summary) ``` ``` ## # A tibble: 3 x 4 ## Species size_avg size_sd size_med ## <fct> <dbl> <dbl> <dbl> ## 1 setosa 2.54 1.85 2.10 ## 2 versicolor 3.57 1.76 3.30 ## 3 virginica 4.28 1.92 4.15 ``` --- ## **What can R do?** Data visualization ![](https://d33wubrfki0l68.cloudfront.net/c7361de6666276165f0e6a1cccf88a9aff64ab90/19a4b/post/2017-09-mpaa/mpaa_files/figure-html/good_will_hunting-1.png) [https://taraskaduk.com/2018/01/10/mpaa-damon/](https://taraskaduk.com/2018/01/10/mpaa-damon/) --- # What can R do? ## Data visualization ![](https://d33wubrfki0l68.cloudfront.net/cd18743b0d0cb9270a884f2df772e64595ac99bb/2dfe8/post/2017-11-pixel-maps/pixel-maps_files/figure-html/unnamed-chunk-5-1.png) [https://taraskaduk.com/2017/11/26/pixel-maps/](https://taraskaduk.com/2017/11/26/pixel-maps/) --- ### **What can R do?** Web apps (A.k.a Shiny) [https://taraskaduk.shinyapps.io/rate/](https://taraskaduk.shinyapps.io/rate/)  --- ## What can R do? ### So much more! - reports - presentations (including this one!) - websites - books --- ## **What can R do?** Bread and butter > *"The best thing about R is that it was written by statisticians. The worst thing about R is that it was written by statisticians."* > **~ Bob Cowgill** (probably) 1 .footnote[ [1 - Why has R, despite quirks, been so successful? - Revolution Analytics](http://blog.revolutionanalytics.com/2015/06/why-has-r-been-so-successful.html) ] --- ## What can R do? ### Statistical analysis and Machine Learning - perform statistical analysis - create, train and test models on your laptop (`caret`, `modelr` packages, etc) - reach to Keras and TensorFlow from within R - et cetera et cetera --- ## R in Power BI ### R in Microsoft What can you do with R inside of MS products? - Run R on SQL Server. - Run R code in Azure ML - Use Microsoft R Server for paralel processing --- [https://microsoft.github.io/sql-ml-tutorials/R/rentalprediction/step/3.html](https://microsoft.github.io/sql-ml-tutorials/R/rentalprediction/step/3.html) ```sql -- Stored procedure that trains and generates an R model using the rental_data and a decision tree algorithm DROP PROCEDURE IF EXISTS generate_rental_rx_model; go CREATE PROCEDURE generate_rental_rx_model (@trained_model varbinary(max) OUTPUT) AS BEGIN EXECUTE sp_execute_external_script @language = N'R' , @script = N' require("RevoScaleR"); rental_train_data$Holiday = factor(rental_train_data$Holiday); rental_train_data$Snow = factor(rental_train_data$Snow); rental_train_data$WeekDay = factor(rental_train_data$WeekDay); #Create a dtree model and train it using the training data set model_dtree <- rxDTree(RentalCount ~ Month + Day + WeekDay + Snow + Holiday, data = rental_train_data); #Before saving the model to the DB table, we need to serialize it trained_model <- as.raw(serialize(model_dtree, connection=NULL));' , @input_data_1 = N'select "RentalCount", "Year", "Month", "Day", "WeekDay", "Snow", "Holiday" from dbo.rental_data where Year < 2015' , @input_data_1_name = N'rental_train_data' , @params = N'@trained_model varbinary(max) OUTPUT' , @trained_model = @trained_model OUTPUT; END; GO ``` --- class: center, middle ![](https://docs.microsoft.com/en-us/azure/machine-learning/studio/media/r-quickstart/fig1.png) --- class: center, middle ![](https://sdtimes.com/wp-content/uploads/2016/01/0113.sdt-news.png) --- class: center, middle ![](https://image.slidesharecdn.com/1-lab209-160901013524/95/microsoft-r-server-for-distributed-computing-23-1024.jpg?cb=1472693770) --- ## R in Power BI That's cool, but what can I do with R in Power BI? - custom R visuals - scripts - visuals --- class: middle, center # Custom R visuals --- ![](http://gqbi.files.wordpress.com/2016/08/082516_0434_binsightpow3.png) http://community.powerbi.com/t5/R-Script-Showcase/bd-p/RVisuals --- # Custom R visuals https://docs.microsoft.com/en-us/power-bi/desktop-r-powered-custom-visuals ![](https://docs.microsoft.com/en-us/power-bi/media/desktop-r-powered-custom-visuals/powerbi-r-powered-custom-viz_3a.png) --- # Custom R visuals ![](https://docs.microsoft.com/en-us/power-bi/media/desktop-r-powered-custom-visuals/powerbi-r-powered-custom-viz_10.png) --- # Custom R Visuals [https://github.com/Microsoft/PowerBI-visuals-forcasting-exp](https://github.com/Microsoft/PowerBI-visuals-forcasting-exp) ```r ets_params = list(Automatic="Z",Multiplicative="M",Additive="A",None="N") if(frequency(timeSeries) == 1) seasonType = "None" deModel = paste(ets_params[[errorType]],ets_params[[trendType]],ets_params[[seasonType]],sep="") if(sum(deModel==c("ANM","ZMA","MMA","AZM","AMZ","AMM","AMA","AMN","AAM")))# Forbidden model combination deModel = "ZZZ" fit = ets(timeSeries, model=deModel,damped=damped) ``` --- # Custom R Visuals [https://github.com/Microsoft/PowerBI-visuals-forcasting-exp](https://github.com/Microsoft/PowerBI-visuals-forcasting-exp) ```r p1a <- p1a + labs (title = pbiInfo, caption = NULL) + theme_bw() p1a <- p1a + xlab(labTime) + ylab(labValue) p1a <- p1a + scale_x_continuous(breaks = seq(1,length(prediction$x) + length(prediction$mean)-1, length.out = numTicks), labels = x_with_forcast_formatted) p1a <- p1a + theme(axis.text.x = element_text(angle = getAngleXlabels(x_with_forcast_formatted), hjust=1, size = sizeTicks, colour = "gray60"), axis.text.y = element_text(vjust = 0.5, size = sizeTicks, colour = "gray60"), plot.title = element_text(hjust = 0.5, size = sizeWarn), axis.title=element_text(size = sizeLabel), axis.text=element_text(size = sizeTicks), panel.border = element_blank()) ``` --- class: middle, center # Custom R visuals in Power BI are well thought-out and overall legit. Use them --- class: middle, center # R Scripts --- # R scripts

 ### - When Power Query can't do the job ### - When Power Query is slow and clunky --- # R scripts This ``` let Source = Web.Page( Web.Contents( "https://github.com/jennybc/gapminder/blob/master/inst/extdata/gapminder.tsv" )), Data = Source{0}[Data], col_types = Table.TransformColumnTypes(Data,{ {"", type text}, {"country", type text}, {"continent", type text}, {"year", Int64.Type}, {"lifeExp", type number}, {"pop", Int64.Type}, {"gdpPercap", type number} }), filter = Table.SelectRows(col_types, each ([year] = 2007)), mutate = Table.AddColumn(filter, "lifeExpMonths", each [lifeExp] * 12, type number), arrange = Table.Sort(mutate,{{"lifeExpMonths", Order.Descending}}) in arrange ``` --- # R scripts VS this ```r library(gapminder) library(dplyr) gapminder %>% filter(year == '2007') %>% mutate(lifeExpMonths = 12 * lifeExp) %>% arrange(desc(lifeExpMonths)) ``` --- # R scripts ## *What If* demo - what_if.R - what_if.pbix - https://app.powerbi.com/view?r=eyJrIjoiNmNjZGE3MzEtMmMxYy00NDRmLWEyZmEtOTAyM2FmNTQzMzc2IiwidCI6IjQ4NTlkNTVmLTkyMjUtNDNmYy1iMWJiLWUwM2I0MmE4NWM0ZCIsImMiOjJ9 --- class:middle, center  --- class:middle, center  --- class:middle, center  ---  --- # R scripts ## Forecast demo - financial_forecast_demo.pbix - financial_forecast_demo.r - https://app.powerbi.com/view?r=eyJrIjoiZWU0ZjUzZGUtZjk5Yi00ZGU1LThhZTgtYWJiNGEzYzFlZjgyIiwidCI6IjQ4NTlkNTVmLTkyMjUtNDNmYy1iMWJiLWUwM2I0MmE4NWM0ZCIsImMiOjJ9 --- class:middle, center  --- class:middle, center  ---  --- # When to use R in Power BI ## Do - performance - machine learning, statistical analysis - custom visualizations ## Don't - when no one else knows R on your team - when you can get by with Power BI - when you can get by with SQL --- # The end ## Follow me: - [https://taraskaduk.com](https://taraskaduk.com) - [https://www.linkedin.com/in/taraskaduk/](https://www.linkedin.com/in/taraskaduk/) - [https://github.com/taraskaduk/](https://github.com/taraskaduk/) - [https://twitter.com/taraskaduk](https://twitter.com/taraskaduk) ## This presentation is here ### https://github.com/taraskaduk/r-in-power-bi ### https://taraskaduk.github.io/rpowerbi.html


Reports chained equality comparisons (i.e.
a==b==c
). Such comparisons are confusing.
Powered by InspectionGadgets


@* * Copyright 2019 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import controllers.util.{Add, Remove} @import views.html.components.add_button @( field: Field, label: String, hint: Option[String] = None, elements: Seq[String] = Seq.empty, labelClass: Option[String] = None, input: Html )(implicit messages: Messages)
| @elem |
|---|


We challenge you to shave, dye or donate
We would like people to either shave part or all of their hair, dye their hair green and blue with permanent or temporary dyes, or donate to Anya to help with her medical costs. Please include photos or videos of what you've done and post it to the Anya's Army Facebook page.


| About Dailyrotten |
|
Feedback
If you like this page, hate it, or would like to suggest changes,
<EMAIL_ADDRESS>is listening. This page
is somewhat different from what we usually offer, so please
do send your feedback.
Help Support Daily Rotten
To this end, you may wish to visit the
Rotten Store. Thanks for helping to keep the lights on.
Adding Stories
If you are a rotten newshound and you would like to suggest a story,
visit our submit page to
send us the URL. Stories that are accepted will have your name credited.
Viewership
On the first full day this page went live, 100,000 people visited this Rotten
News page. Of course that was the day after the WTC attacks, so that number is
somewhat distorted. Right now this page gets between 50,000 and 75,000 people
every day.
Linking
We encourage everyone to link to this page; if you like it, others probably
will as well.
Other Rotten
Rotten
Pornopolis
Gaping Maw
Celebrity Morgue
Mugshots
Rotten Store
Shockumentary
Rate My Poo
Rate My Kitten
Rate My Bunny
Rate My Puppy
Rate My Finger
Penny Postcards
Leisure Town
Jerkcity
Phallic
Dr. Sputnik
Boners
Dead Pool
NNDB
Home
Make Dailyrotten your start page
|
|
|
April 28, 2002
Lisa Left Eye Lopez death photo
Tiempo | Submitted by: Sandchip
Many people have been asking for a death photo of Left Eye Lopez,
killed recently in a Central American sport-utility vehicle accident,
and Honduran newspaper Tiempo comes through shining.
Resplendent in her fabulous pink monkey outfit, a picture that would
never be shown in US newspapers. The article is in Spanish, however.
|
|
Read article...
|
|
McPsycho kept parents on ice
Daily Record | Submitted by: atomic tony tiki
"In a chilling scene, similar to the movie Psycho, it is believed he
kept his parents preserved for three years because he could not bear to
be parted from them... Last night, a police source said: "The bodies had
been expertly embalmed and appeared to have been cared for by their son.
"He was a really strange little man but we never suspected
anything like this."
|
|
Read article...
|
|
Drug drive-through window shut down by police
Rochester Democrat and Chronicle | Submitted by: J
"Detectives heard for several weeks that people in the rear apartment
of the five-unit building had followed the fast-food concept and opened
a drug trade business through a back window. Customers simply could
ring the buzzer, place an order, and pick up their drugs... Metal bars
had been installed on the drive-through window "to keep dissatisfied
customers from getting at the goods or the employees," Cecile said."
|
|
Read article...
|
|
Man, now woman, wants to be man again
The Scotsman | Submitted by: Insanewarlock
"The 49-year-old says her experiment with womanhood has failed, largely
as a result of the blinkered attitudes of the Ayrshire community where she
lives. The former member of the Scots Guards says she has suffered verbal
and physical abuse since her sex swap operation almost four years ago,
and wishes it could be reversed." It seems that nobody wanted to go out
with her.
|
|
Read article...
|
|
Hell's Angels tattoo removed
Aftonbladet | Submitted by: anonymous
A former member of the Hells Angels has his tattoo forcibly removed
by other members, with a grinding machine. The article is unfortunately
in Swedish, but with picture included.
|
|
Read article...
|
|
Whiny journalist rails on excrement
Guardian | Submitted by: wingnut
"In his Spectator piece he also painted a pretty grim picture of life
for British journalists staying at the Bagram airbase. "For days now,
several piles of human excrement have stood only yards from the row of
poorly erected communal tents where the press doss down," he said.
"The excrement results from an only partly successful attempt to empty
a row of portable toilets which the US army refers to as porta-potties
and I am sure that its enduring presence is in no way intended
as a message to the journalists."
|
|
Read article...
|
|
|
|
|


Jose Mourinho gets down to work at Tottenham ahead of first home game in charge of new club
Spurs take on Olympiacos in the Champions League on Tuesday night knowing a win would seal qualification to the knockout stages of the competition
by Irishmirror.ieNew Tottenham boss Jose Mourinho appeared before the cameras on the training ground ahead of the Champions League clash with Olympiacos.
Cameras were allowed onto the training ground at Hotspur Way for a 15-minute open session and they saw Mourinho, less than a week into his new job, spend time with all three groups of players - those who played at the weekend, those that were not involved and the goalkeepers.
He again seemed in a good mood, exchanging pleasantries with some foreign journalists and sharing jokes with the staff.
Spurs fans will be encouraged to see Tanguy Ndombele and Jan Vertonghen in training after the two were ruled out of the weekend's win against West Ham with injury, while Harry Kane was also present despite suffering a knock in the game.
Mourinho was delighted after his reign Spurs got off the perfect start on Saturday with the 3-2 victory over the Hammers at the London Stadium, their first away win in the Premier League since January.
Goals from Heung-Min Son, Lucas Moura and Harry Kane gave Spurs a convincing lead, before Michail Antonio and Angelo Ogbonna restored some pride for the Hammers.
Mourinho will be desperate to win his first home game at the club, with victory sealing Spurs' place in the last-16 of the Champions League.
After the victory against West Ham Mourinho said: "It was very very important. 11 months without music in the away dressing room, without a smile or happiness. They did it. I am very happy for them and with them. If someone only saw the result they'd have thought it was very difficult for us.
But it was probably closer to a 4-0 than 3-1. I think my players paid the price of a very difficult week. International break, change of manager, new guy, different training sessions.
"We have a game in two days. I think we can go and win that match at home and qualify in the Champions League and I think the mood becomes high for the boys."


HealthTech Sydney is a leading innovation community for healthcare technology that aims to improve education and accelerate commercialisation of ideas in healthcare. HealthTech Sydney connects players from research, medicine, biotechnology, and healthcare with technology, entrepreneurship, design and business to grow and support innovation in health.
The Why
For nearly 3 years, I've been leading a digital health innovation community named HealthTech Sydney. As a young biotech engineer in Australia, I worked on cochlear implant calibration and speech pathology software at the Bionic Ear Institute. However, there was no local network that made it easy to find mentors, active companies and problems to solve. It meant lack of career opportunities, and leaving health technology to work in finance for many years. But my passion has always been in healthcare, to develop innovative technologies into new products. So, I left one rewarding career and pivoted back to healthcare. I want to prevent this from happening to talented professionals who have a passion that is much needed in industries of the future, but lack opportunities for a rewarding scientific career.
Healthcare & Technology
Australia is home to a deep scientific community and successful health companies like Resmed, Cochlear, Saluda Medical, Clarity Pharmaceuticals, Lorica Health, NeuClone, SpeeDx, Prospection, Precedence Healthcare and Osprey Medical to name just a few. However, successfully commercialising innovation is complex and requires combining multiple knowledge domains. The executives and scientists who have managed to create world-class companies have done it through great rigour, and often with little initial assistance or appreciation of their vision. Their experience is profound, and I believe it is crucial that their knowledge be applied to guide the paths of new entrants in the workforce, and design new business ideas that challenge incumbent models.
Innovation in Digital Health
Healthcare is a highly specialised industry with low levels of integration across services and solutions. The expectations of 'ready-to-go' customer experience remains unfulfilled in healthcare services, not only for patients but also for many of the doctors and service providers in this field. This is changing with new niche solutions provided by companies that cater to the needs of specific patient groups, providing high quality of care and improving outcomes in a privately managed patient services ecosystem. This is the inception of creative upheaval in healthcare - by those who innovate despite the complexity.
We are in times of great change. Competitive forces birth new business solutions just as they render unadaptable ones to dust. Easily accessible technologies and impassioned entrepreneurs have overturned businesses in all sectors. Our careers span decades, geographies and now multiple industries. We need to remain on a continuous learning path. Healthcare is the latest one to feel the forces of innovative upheaval, and we need to keep up with the advances.
Reflecting on the difficulty of knowledge sharing in healthcare, a thriving community ecosystem needed development.
The Importance of Communities
A community fills the gap in an ecosystem where there is no supporting infrastructure to learn, engage and lead. It provides grassroots evidence of a need that precedes the development of a formal exchange or solution, either for knowledge or commerce. The gap is filled where the existing formal organisations do not cater for emerging customer segments, who have a different price point and use case. This exclusion occurs when the main avenue to learn and connect with like-minded professionals is via conferences that price out most people, or are not often enough to sustain an ecosystem.
A thirst for knowledge, connectivity and a shared vision to create positive change in the world is what sustains community groups. There are many people out there who want to put a 'dent in the universe', but lack a vehicle to help get them there. A vibrant community provides one such route.
So, these are lessons I've learnt from running HealthTech Sydney. I believe these principles can be applied in a variety of scenarios, companies, and organisations looking to seed ideas and build communities; from low-resource settings in developing countries, to corporates and incubators thinking about managing innovation groups, culture and new ideas.
Have a passionate vision: Your passion is infectious. It permeates the culture, attracting those with a similar vision to affect change. One of the main reasons I run HealthTech Sydney is to strive toward a vision of making Australia a major health-tech hub. This is also a core quality to seek in building the team around you, and to paraphrase Josh Tetrick (CEO, Hampton Creek), "It's not hard to recruit the best people if your values and vision are to positively impact mankind." (Founder World 2015, SF)
Pick a pain point: Draw the attention of the community to a pain point that has driven health, technology, government or business conversations and strategic agendas. Talk to members to find out what keeps them up at night, what makes their jobs difficult, what patients care about, and what kills entrepreneur's business ideas and companies, or extirpates the potential impact of innovative research and technology. Addressing these pain points is crucial to improving innovation outcomes and realising the potential of serving unmet needs with relevant services. These conversations drive selection of the most pertinent topics that people care about and can rally behind.
Empower the community: I believe a community is a member-centric organisation that should provide maximum benefit to members for their patronage. The organisation is the channel that empowers members to achieve their objectives. In HeathTech Sydney, an aim has been to connect professionals and leverage the broad multi-disciplinary expertise in the group to achieve learning and innovation outcomes. The social, exploratory conversations in a community that uncover pain points also lead to discovering the expert knowledge and experience of your members. I've learnt to ask more questions and listen more closely in the process.
In 2015, we held an event focusing on oncology clinical trial management that went into the frustrations and failures of managing this important stage for new drugs and devices. It was incredible to hear the accounts of Dr Ben Kong and Dr Vishal Gopal who manage oncology trials at a major Sydney hospital. Clinical trials for cancer may be international efforts that span hospitals in several countries. The difficulties are many, including understanding patient reaction to therapy, responding in timely fashion, cataloguing consistently and facilitating easy access to data. This was an incredible talk that kept attendees glued to their chairs (videos). I later discovered that Flatiron (NY, USA) are working on a solution to just this global problem, providing validation of the relevance of the discussions.
Go deep on content: There is limited value in answering questions that are easily accessible, documented, or skin-deep in content. Real value comes from deep conversations that delve into a topic in great depth, and showcase solutions with multiple use-cases. Leverage expertise in innovative companies to talk about design considerations of developing their solutions to understand what works and what doesn't. These are often the most invaluable lessons in designing innovative products - the considerations and failures that others have been through. Challenge your assumptions and always ask 'why' - don't accept things at face value.
Prepare and give your best knowledge: There is deep satisfaction in learning about trending topics and delving into the complexities of innovative businesses and technologies. There is greater satisfaction in sharing this with others. I learnt a lot of great concepts and frameworks during my MBA at IE Business School that I use in thinking about innovation, and that I wanted to share with others going through an explorative journey in strategy and technology.
However, if the objective is to be on the leading edge of news, innovation and technology, expect to be challenged. You need to do at least 3-5 hours of preparation to present in an engaging way for 5 min on a new topic. Share your best knowledge and spend time on preparation as this raises the quality and outcomes for everyone in the community. It also distinguishes your industry event from the numerous events readily available in cities most nights, and doesn't waste the time of attendees and speakers.
Build a great team: I'm very thankful for the team and supporters who helped build HealthTech Sydney. I could not have delivered the quality and number of events without them. In the past three years, I went from almost single-handedly delivering seminars, to creating a team of four who have been critical in building and sustaining the community. In any enterprise, scale, consistency and quality requires dedication and teamwork. Building a great team requires training, establishing processes, building confidence, and constantly improving. If you want to create an innovation community, select people with broad skills but a shared passion. Establish tasks ownership, expectations of commitment, and help measure success. Communicate clearly, and celebrate together.
I'd like to acknowledge Lissanthea Taylor for seeding the initial Meetup group in 2013. The group has expanded rapidly and there are now similar groups in Melbourne, Brisbane and Canberra. We welcome you to join us as we build our new platform - HealthTech Sydney.
In Part 2 of this article, I will share the remaining lessons and provide some updates on the vision ahead. I look forward to hearing your experiences in building communities.


In [1]: import pandas as pd In [2]: import matplotlib.pyplot as plt # use the pandas main colors In [3]: import matplotlib as mpl In [4]: mpl.rcParams['axes.prop_cycle'] = mpl.cycler(color=["#150458", "#FFCA00", "#E70488"])
For this tutorial, air quality data about \(NO_2\) is used, made available by openaq and using the py-openaq package. The air_quality_no2.csv data set provides \(NO_2\) values for the measurement stations FR04014, BETR801 and London Westminster in respectively Paris, Antwerp and London.
air_quality_no2.csv
In [5]: air_quality = pd.read_csv("data/air_quality_no2.csv", ...: index_col=0, parse_dates=True) ...: In [6]: air_quality.head() Out[6]: station_antwerp station_paris station_london datetime 2019-05-07 02:00:00 NaN NaN 23.0 2019-05-07 03:00:00 50.5 25.0 19.0 2019-05-07 04:00:00 45.0 27.7 19.0 2019-05-07 05:00:00 NaN 50.4 16.0 2019-05-07 06:00:00 NaN 61.9 NaN
Note
The usage of the index_col and parse_dates parameters of the read_csv function to define the first (0th) column as index of the resulting DataFrame and convert the dates in the column to datetime objects, respectively.
index_col
parse_dates
read_csv
I want a quick visual check of the data.
In [7]: air_quality.plot() Out[7]: <matplotlib.axes._subplots.AxesSubplot at 0x7f2d4d843150>
With a DataFrame, pandas creates by default one line plot for each of the columns with numeric data.
I want to plot only the columns of the data table with the data from Paris.
In [8]: air_quality["station_paris"].plot() Out[8]: <matplotlib.axes._subplots.AxesSubplot at 0x7f2d0e8b8090>
To plot a specific column, use the selection method of the subset data tutorial in combination with the plot method. Hence, the plot method works on both Series and DataFrame.
plot
Series
DataFrame
I want to visually compare the \(N0_2\) values measured in London versus Paris.
In [9]: air_quality.plot.scatter(x="station_london", ...: y="station_paris", ...: alpha=0.5) ...: Out[9]: <matplotlib.axes._subplots.AxesSubplot at 0x7f2d4d843890>
Apart from the default line plot when using the plot function, a number of alternatives are available to plot data. Let’s use some standard Python to get an overview of the available plot methods:
line
In [10]: [method_name for method_name in dir(air_quality.plot) if not method_name.startswith("_") ] Out[10]: ['area', 'bar', 'barh', 'box', 'density', 'hexbin', 'hist', 'kde', 'line', 'pie', 'scatter']
In many development environments as well as ipython and jupyter notebook, use the TAB button to get an overview of the available methods, for example air_quality.plot. + TAB.
air_quality.plot.
One of the options is box, which refers to a boxplot. Also the box method is applicable on the air quality example data:
box
In [11]: air_quality.plot.box() Out[11]: <matplotlib.axes._subplots.AxesSubplot at 0x7f2d0e801a50>
For an introduction to the other plot methods, see Other plots.
I want each of the columns in a separate subplot.
In [12]: axs = air_quality.plot.area(figsize=(12, 4), subplots=True)
Separate subplots for each of the data columns is supported by the subplots argument of the plot functions. The builtin options available in each of the pandas plot functions that are worthwhile to have a look.
subplots
Some more formatting options of the pandas plot functionalities are explained in Plot Formatting.
I want to further customize, extend or save the resulting plot.
In [13]: fig, axs = plt.subplots(figsize=(12, 4)); In [14]: air_quality.plot.area(ax=axs); In [15]: axs.set_ylabel("NO$_2$ concentration"); In [16]: fig.savefig("no2_concentrations.png")
Each of the plot objects created by pandas are a matplotlib object. As Matplotlib provides plenty of options to customize plots, making the link between pandas and matplotlib explicit enables all the power of matplotlib to the plot. This strategy is applied in the previous example:
fig, axs = plt.subplots(figsize=(12, 4)) # Create an empty matplotlib Figure and Axes air_quality.plot.area(ax=axs) # Use pandas to put the area plot on the prepared Figure/Axes axs.set_ylabel("NO$_2$ concentration") # Do any matplotlib customization you like fig.savefig("no2_concentrations.png") # Save the Figure/Axes using the existing matplotlib method.
The .plot methods are applicable on both Series and DataFrames
.plot
By default, each of the columns is plotted as a different element (line, boxplot,…)
Any plot created by pandas is a matplotlib object.
Further details about indexing is provided in Visualization.


Email
Password
Sign up Log in?
Log in Forgot password?
Enter your account's email
Send Cancel
Change email
Save Cancel
Set new password
Are you sure you want to delete your account?


onProximity Fade - Demo
Little Boxes
Box
Box
Box
Box
Box
Box
Box
Box
Box
Row Links
some row text
some link
link 2
some row text
some link
link 2
some row text
some link
link 2
some row text
some link
link 2
some row text
some link
link 2