Web-site under development!
North West Sterling Homes INC.
General contractor
Portland, Oregon
Phone-number (clickable):
+1(503)-740-08-66
Email (clickable):
nwsterlinghomes@gmail.com


Hyperspectral-Image-classification
Home
About Project
Project Team
Contact Us
Column 1
Upload Image
>
RESULT
GRAPH


Nth level Poll drill down control.
Below is the list of functionality.
[1] You can define any number of drill down detail.
[2] Set Bar color as per rules.
[2.1] value >= 50 bar color green.
[2.2] value < 50 bar color orange.
[2.3] value <= 10 bar color red.
How to test control.
[1] First level : Just click on Chrome
[2] Second level : click on chrome-2014
[3] click on "November" so you will back to browser main statistic.


ProPlanner
Login or Register
FAQ
Login
Username:
Password:
Register
Username:
First Name:
Last Name:
Email:
Password:


Broadcasting in ONNX¶
In ONNX, element-wise operators can take inputs with different shape, as long as the input tensors are broadcastable to the same shape. ONNX supports two types of broadcasting: multidirectional broadcasting and unidirectional broadcasting. We will introduce these two types of broadcasting respectively in the following sections.
Multidirectional Broadcasting¶
In ONNX, a set of tensors are multidirectional broadcastable to the same shape if one of the following is true:
The tensors all have exactly the same shape.
The tensors all have the same number of dimensions and the length of each dimensions is either a common length or 1.
The tensors that have too few dimensions can have their shapes prepended with a dimension of length 1 to satisfy property 2.
For example, the following tensor shapes are supported by multidirectional broadcasting:
shape(A) = (2, 3, 4, 5), shape(B) = (,), i.e. B is a scalar ==> shape(result) = (2, 3, 4, 5)
shape(A) = (2, 3, 4, 5), shape(B) = (5,), ==> shape(result) = (2, 3, 4, 5)
shape(A) = (4, 5), shape(B) = (2, 3, 4, 5), ==> shape(result) = (2, 3, 4, 5)
shape(A) = (1, 4, 5), shape(B) = (2, 3, 1, 1), ==> shape(result) = (2, 3, 4, 5)
shape(A) = (3, 4, 5), shape(B) = (2, 1, 1, 1), ==> shape(result) = (2, 3, 4, 5)
Multidirectional broadcasting is the same as Numpy’s broadcasting.
Multidirectional broadcasting is supported by the following operators in ONNX:
Add
And
Div
Equal
Greater
Less
Max
Mean
Min
Mul
Or
Pow
Sub
Sum
Where
Xor
Unidirectional Broadcasting¶
In ONNX, tensor B is unidirectional broadcastable to tensor A if one of the following is true:
Tensor A and B both have exactly the same shape.
Tensor A and B all have the same number of dimensions and the length of each dimensions is either a common length or B’s length is 1.
Tensor B has too few dimensions, and B can have its shapes prepended with a dimension of length 1 to satisfy property 2.
When unidirectional broadcasting happens, the output’s shape is the same as the shape of A (i.e., the larger shape of two input tensors).
In the following examples, tensor B is unidirectional broadcastable to tensor A:
shape(A) = (2, 3, 4, 5), shape(B) = (,), i.e. B is a scalar ==> shape(result) = (2, 3, 4, 5)
shape(A) = (2, 3, 4, 5), shape(B) = (5,), ==> shape(result) = (2, 3, 4, 5)
shape(A) = (2, 3, 4, 5), shape(B) = (2, 1, 1, 5), ==> shape(result) = (2, 3, 4, 5)
shape(A) = (2, 3, 4, 5), shape(B) = (1, 3, 1, 5), ==> shape(result) = (2, 3, 4, 5)
Unidirectional broadcasting is supported by the following operators in ONNX:
Gemm
PRelu


tcraig
Your browser does not support svg images
about
projects
archive
email
lights 💡
Introduction
27/05/2018
« Previous
Next »


Attorney at Law
We have been representing clients for Social Security Disability (SSI & SSDI) matters for over thirty-five years; also certified as a representative for veterans before the Veterans Administration; and offering estate planning with an emphasis on issues involving Social Security while providing Wills and Probate. First appointments for Social Security disability benefits and VA benefits are without cost to you. Services can also be provided for Texas Legal Protection Plan members. Other appointments may be charged a minimal fee based on the time and experience required for the service provided.
About Ms. Felps - Personally handling each case for over thirty years.
Social Security Disability - What you need to know about your benefits.
Federal Court Appeals - Social Security appeals, including those of other attorneys.
Q & A - Commonly asked questions about Social Security.
Contact Info - Phone, Fax, Postal, and E-mail Addresses.
Directions - To the conveniently located office in Central Austin.
Links - Other sites of interest related to Social Security claimants.
3724 Jefferson
St. Ste. 309
Franklin Square
Austin TX 78731
Tel: (512)
478-4973
Fax:<PHONE_NUMBER>
E-mail: Contact
Form


{% extends "ashgear/base.html" %} {% load static %} {% block content %}
Sell or rent.
Tools we have in stock.
Software, books, accessories
Tool grinding ...


--- layout: post title: "Who's Funding Testing and Test Monitoring Startups?" date: 2016-12-17 09:35:00 +0000 tags: image: https://s3.amazonaws.com/hackedu/2016-12-17-pigeon.jpg imagecredits: https://www.flickr.com/photos/hommedechevre/2537927345 ---
This article helps provide funding data for part 8 of my annual review of the year in ed-tech
The following “proctoring” and testing startups raised funding in 2016:
Acquisitions include Performance Matters (acquired by Weld North), GL Education (acquired by Levine Leichtman Capital Partners), WebAssign (acquired by Cengage), Astute Technology (acquired by Echo360)


I'm Joe Johnson. I am a develper based in NYC.I have 10 years experinece in the graphic design world, specializing in the creation of responsive websites.


Example: Init from <ul> element
This sample initializes the tree from a <ul> element.
- item1 with key and tooltip
- item2: selected on init
- Folder with some children
- Sub-item 3.1
- Sub-item 3.2
- Document with some children (expanded on init)
- Sub-item 4.1
- Sub-item 4.2
Active node: -
jquery_dynatree.js project home
Link to this page
Example Browser
View source code


16) Data Manipulation with Pandas¶
Related references:
First, let’s check that we have Pandas installed¶
Previous lectures had instructions to install Pandas. Let’s check if we are good to go!
In [1]:
# Just as NumPy is commonly abbreviated as 'np', Pandas is abbreviated as 'pd'
import pandas as pd
pd.__version__
Out[1]:
'0.21.0'
Pandas extends features of NumPy¶
Pandas is a new library built on NumPy. Ever wish you could have column
and row labels on a NumPy ndarray
? The Pandas DataFrame
answers
that wish, and can also handle heterogeneous types and/or missing data!
The three main data types in Pandas are built on the Numpy ndarray
:
Series
DataFrame
Index
We’ll also be using NumPy later, so we’ll import that now.
In [2]:
import numpy as np
The Pandas Series
Object¶
A Series
is a one-dimensional array-like object containing a
sequence of values (of similar types to NumPy types) and an associated
array of data labels, called its index. The simplest Series is formed
from only an array of data:
In [3]:
obj = pd.Series([4, 7, -5, 3])
obj
Out[3]:
0 4
1 7
2 -5
3 3
dtype: int64
The string representation of a Series displayed interactively shows the index on the left and the values on the right. Since we did not specify an index for the data, a default one consisting of the integers 0 through N - 1 (where N is the length of the data) is created. You can get the array representation and index object of the Series via its values and index attributes, respectively:
In [4]:
obj.values
Out[4]:
array([ 4, 7, -5, 3])
In [5]:
obj.index # like range(4)
Out[5]:
RangeIndex(start=0, stop=4, step=1)
Often it will be desirable to create a Series with an index identifying each data point with a label:
In [6]:
obj2 = pd.Series([4, 7, -5, 3], index=['d', 'b', 'a', 'c'])
obj2
Out[6]:
d 4
b 7
a -5
c 3
dtype: int64
In [7]:
obj2.index
Out[7]:
Index(['d', 'b', 'a', 'c'], dtype='object')
Like with a NumPy array, data can be accessed by the associated index via the familiar Python square-bracket notation:
In [8]:
obj2[1:3]
Out[8]:
b 7
a -5
dtype: int64
Compared with NumPy arrays, you can use labels in the index when selecting single values or a set of values:
In [9]:
obj2['a']
Out[9]:
-5
In [10]:
obj2['d'] = 6
obj2[['c', 'a', 'd']]
Out[10]:
c 3
a -5
d 6
dtype: int64
Here [‘c’, ‘a’, ‘d’] is interpreted as a list of indices, even though it contains strings instead of integers.
Using NumPy functions or NumPy-like operations, such as filtering with a boolean array, scalar multiplication, or applying math functions, will preserve the index-value link:
In [11]:
obj2[obj2 > 0]
Out[11]:
d 6
b 7
c 3
dtype: int64
In [12]:
obj2 * 2
Out[12]:
d 12
b 14
a -10
c 6
dtype: int64
In [13]:
np.exp(obj2)
Out[13]:
d 403.428793
b 1096.633158
a 0.006738
c 20.085537
dtype: float64
Another way to think about a Series is as a fixed-length, ordered dict, as it is a mapping of index values to data values. It can be used in many contexts where you might use a dict:
In [14]:
'b' in obj2
Out[14]:
True
In [15]:
'e' in obj2
Out[15]:
False
Should you have data contained in a Python dict, you can create a Series from it by passing the dict:
In [16]:
sdata = {'Ohio': 35000, 'Texas': 71000, 'Oregon': 16000, 'Utah': 5000}
obj3 = pd.Series(sdata)
obj3
Out[16]:
Ohio 35000
Oregon 16000
Texas 71000
Utah 5000
dtype: int64
When you are only passing a dict, the index in the resulting Series will have the dict’s keys in sorted order. You can override this by passing the dict keys in the order you want them to appear in the resulting Series:
In [17]:
states = ['California', 'Ohio', 'Oregon', 'Texas']
obj4 = pd.Series(sdata, index=states)
obj4
Out[17]:
California NaN
Ohio 35000.0
Oregon 16000.0
Texas 71000.0
dtype: float64
Here, three values found in sdata were placed in the appropriate
locations, but since no value for California
was found, it appears
as NaN (not a number), which is considered in pandas to mark missing or
NA values. Since ‘Utah’ was not included in states, it is excluded from
the resulting object.
The isnull and notnull functions in pandas should be used to detect missing data:
In [18]:
pd.isnull(obj4)
Out[18]:
California True
Ohio False
Oregon False
Texas False
dtype: bool
In [19]:
pd.notnull(obj4)
Out[19]:
California False
Ohio True
Oregon True
Texas True
dtype: bool
Series also has these as instance methods:
In [20]:
obj4.isnull()
Out[20]:
California True
Ohio False
Oregon False
Texas False
dtype: bool
A useful Series feature for many applications is that it automatically aligns by index label in arithmetic operations:
In [21]:
obj3
Out[21]:
Ohio 35000
Oregon 16000
Texas 71000
Utah 5000
dtype: int64
In [22]:
obj4
Out[22]:
California NaN
Ohio 35000.0
Oregon 16000.0
Texas 71000.0
dtype: float64
In [23]:
obj3 + obj4
Out[23]:
California NaN
Ohio 70000.0
Oregon 32000.0
Texas 142000.0
Utah NaN
dtype: float64
Both the Series object itself and its index have a name attribute, which integrates with other key areas of pandas functionality:
In [24]:
obj4.name = 'population'
obj4.index.name = 'state'
obj4
Out[24]:
state
California NaN
Ohio 35000.0
Oregon 16000.0
Texas 71000.0
Name: population, dtype: float64
A Series’s index can be altered in-place by assignment:
In [25]:
obj
Out[25]:
0 4
1 7
2 -5
3 3
dtype: int64
In [26]:
obj.index = ['Bob', 'Steve', 'Jeff', 'Ryan']
obj
Out[26]:
Bob 4
Steve 7
Jeff -5
Ryan 3
dtype: int64
The Pandas DataFrame
Object¶
A DataFrame represents a rectangular table of data and contains an ordered collection of columns, each of which can be a different value type (numeric, string, boolean, etc.). The DataFrame has both a row and column index; it can be thought of as a dict of Series all sharing the same index. Under the hood, the data is stored as one or more two-dimensional blocks rather than a list, dict, or some other collection of one-dimensional arrays.
FYI: While a DataFrame is physically two-dimensional, you can use it to represent higher dimensional data in a tabular format using hierarchical indexing, which we’ll come back to later.
There are many ways to construct a DataFrame
, though one of the most
common is from a dict of equal-length lists or NumPy arrays:
In [27]:
data = {'state': ['Ohio', 'Ohio', 'Ohio', 'Nevada', 'Nevada', 'Nevada'],
'year': [2000, 2001, 2002, 2001, 2002, 2003],
'pop': [1.5, 1.7, 3.6, 2.4, 2.9, 3.2]}
frame = pd.DataFrame(data)
The resulting DataFrame will have its index assigned automatically as with Series, and the columns are placed in sorted order:
In [28]:
frame
Out[28]:
| pop | state | year | |
|---|---|---|---|
| 0 | 1.5 | Ohio | 2000 |
| 1 | 1.7 | Ohio | 2001 |
| 2 | 3.6 | Ohio | 2002 |
| 3 | 2.4 | Nevada | 2001 |
| 4 | 2.9 | Nevada | 2002 |
| 5 | 3.2 | Nevada | 2003 |
FYI: Thank Jupyter notebooks for the nice DataFrame output format.
For large DataFrames, the head method selects only the first five rows:
In [29]:
frame.head()
Out[29]:
| pop | state | year | |
|---|---|---|---|
| 0 | 1.5 | Ohio | 2000 |
| 1 | 1.7 | Ohio | 2001 |
| 2 | 3.6 | Ohio | 2002 |
| 3 | 2.4 | Nevada | 2001 |
| 4 | 2.9 | Nevada | 2002 |
If you pass a column that isn’t contained in the dict, it will appear with missing values in the result:
In [30]:
frame2 = pd.DataFrame(data, columns=['year', 'state', 'pop', 'debt'],
index=['one', 'two', 'three', 'four',
'five', 'six'])
frame2
Out[30]:
| year | state | pop | debt | |
|---|---|---|---|---|
| one | 2000 | Ohio | 1.5 | NaN |
| two | 2001 | Ohio | 1.7 | NaN |
| three | 2002 | Ohio | 3.6 | NaN |
| four | 2001 | Nevada | 2.4 | NaN |
| five | 2002 | Nevada | 2.9 | NaN |
| six | 2003 | Nevada | 3.2 | NaN |
A column in a DataFrame can be retrieved as a Series either by dict-like notation or by attribute:
In [31]:
frame2['state']
Out[31]:
one Ohio
two Ohio
three Ohio
four Nevada
five Nevada
six Nevada
Name: state, dtype: object
Rows can also be retrieved by position or name with the special loc
attribute:
In [32]:
frame2.loc['three']
Out[32]:
year 2002
state Ohio
pop 3.6
debt NaN
Name: three, dtype: object
Columns can be modified by assignment. For example, the empty ‘debt’ column could be assigned a scalar value or an array of values:
In [33]:
frame2['debt'] = 16.5
frame2
Out[33]:
| year | state | pop | debt | |
|---|---|---|---|---|
| one | 2000 | Ohio | 1.5 | 16.5 |
| two | 2001 | Ohio | 1.7 | 16.5 |
| three | 2002 | Ohio | 3.6 | 16.5 |
| four | 2001 | Nevada | 2.4 | 16.5 |
| five | 2002 | Nevada | 2.9 | 16.5 |
| six | 2003 | Nevada | 3.2 | 16.5 |
In [34]:
frame2['debt'] = np.arange(6.)
frame2
Out[34]:
| year | state | pop | debt | |
|---|---|---|---|---|
| one | 2000 | Ohio | 1.5 | 0.0 |
| two | 2001 | Ohio | 1.7 | 1.0 |
| three | 2002 | Ohio | 3.6 | 2.0 |
| four | 2001 | Nevada | 2.4 | 3.0 |
| five | 2002 | Nevada | 2.9 | 4.0 |
| six | 2003 | Nevada | 3.2 | 5.0 |
When you are assigning lists or arrays to a column, the value’s length must match the length of the DataFrame. If you assign a Series, its labels will be realigned exactly to the DataFrame’s index, inserting missing values in any holes:
In [35]:
val = pd.Series([-1.2, -1.5, -1.7], index=['two', 'four', 'five'])
frame2['debt'] = val
frame2
Out[35]:
| year | state | pop | debt | |
|---|---|---|---|---|
| one | 2000 | Ohio | 1.5 | NaN |
| two | 2001 | Ohio | 1.7 | -1.2 |
| three | 2002 | Ohio | 3.6 | NaN |
| four | 2001 | Nevada | 2.4 | -1.5 |
| five | 2002 | Nevada | 2.9 | -1.7 |
| six | 2003 | Nevada | 3.2 | NaN |
Assigning a column that doesn’t exist will create a new column. The
del
keyword will delete columns as with a dict.
As an example of del
, let’s add a new column of boolean values where
the state column equals ‘Ohio’
In [36]:
frame2['eastern'] = frame2['state'] == 'Ohio'
frame2
Out[36]:
| year | state | pop | debt | eastern | |
|---|---|---|---|---|---|
| one | 2000 | Ohio | 1.5 | NaN | True |
| two | 2001 | Ohio | 1.7 | -1.2 | True |
| three | 2002 | Ohio | 3.6 | NaN | True |
| four | 2001 | Nevada | 2.4 | -1.5 | False |
| five | 2002 | Nevada | 2.9 | -1.7 | False |
| six | 2003 | Nevada | 3.2 | NaN | False |
The del
method can then be used to remove this column:
In [37]:
del frame2['eastern']
frame2.columns
Out[37]:
Index(['year', 'state', 'pop', 'debt'], dtype='object')
Caution: The column returned from indexing a DataFrame is a view on
the underlying data, not a copy. Thus, any in-place modifications to the
Series will be reflected in the DataFrame. The column can be explicitly
copied with the Series’s copy
method.
Another common form of data is a nested dict of dicts:
In [38]:
pop = {'Nevada': {2001: 2.4, 2002: 2.9},
'Ohio': {2000: 1.5, 2001: 1.7, 2002: 3.6}}
If the nested dict is passed to the DataFrame, pandas will interpret the outer dict keys as the columns and the inner keys as the row indices:
In [39]:
frame3 = pd.DataFrame(pop)
frame3
Out[39]:
| Nevada | Ohio | |
|---|---|---|
| 2000 | NaN | 1.5 |
| 2001 | 2.4 | 1.7 |
| 2002 | 2.9 | 3.6 |
Given a two-dimensional array of data, we can create a DataFrame
with any specified column and index names. If omitted, an integer index
will be used for each:
In [40]:
pd.DataFrame(np.random.rand(3, 2),
columns=['foo', 'bar'],
index=['a', 'b', 'c'])
Out[40]:
| foo | bar | |
|---|---|---|
| a | 0.643174 | 0.754775 |
| b | 0.194838 | 0.872414 |
| c | 0.054671 | 0.933107 |
You can transpose the DataFrame (swap rows and columns) with similar syntax to a NumPy array:
In [41]:
frame3.T
Out[41]:
| 2000 | 2001 | 2002 | |
|---|---|---|---|
| Nevada | NaN | 2.4 | 2.9 |
| Ohio | 1.5 | 1.7 | 3.6 |
The keys in the inner dicts are combined and sorted to form the index in the result. This isn’t true if an explicit index is specified:
In [42]:
pd.DataFrame(pop, index=[2001, 2002, 2003])
Out[42]:
| Nevada | Ohio | |
|---|---|---|
| 2001 | 2.4 | 1.7 |
| 2002 | 2.9 | 3.6 |
| 2003 | NaN | NaN |
Dicts of Series are treated in much the same way:
In [43]:
pdata = {'Ohio': frame3['Ohio'][:-1],
'Nevada': frame3['Nevada'][:2]}
pd.DataFrame(pdata)
Out[43]:
| Nevada | Ohio | |
|---|---|---|
| 2000 | NaN | 1.5 |
| 2001 | 2.4 | 1.7 |
If a DataFrame’s index and columns have their name attributes set, these will also be displayed:
In [44]:
frame3.index.name = 'year'
frame3.columns.name = 'state'
frame3
Out[44]:
| state | Nevada | Ohio |
|---|---|---|
| year | ||
| 2000 | NaN | 1.5 |
| 2001 | 2.4 | 1.7 |
| 2002 | 2.9 | 3.6 |
As with Series, the values attribute returns the data contained in the DataFrame as a two-dimensional ndarray:
In [45]:
frame3.values
Out[45]:
array([[ nan, 1.5],
[ 2.4, 1.7],
[ 2.9, 3.6]])
If the DataFrame’s columns are different dtypes, the dtype of the values array will be chosen to accommodate all of the columns:
In [46]:
frame2.values
Out[46]:
array([[2000, 'Ohio', 1.5, nan],
[2001, 'Ohio', 1.7, -1.2],
[2002, 'Ohio', 3.6, nan],
[2001, 'Nevada', 2.4, -1.5],
[2002, 'Nevada', 2.9, -1.7],
[2003, 'Nevada', 3.2, nan]], dtype=object)
The Pandas Index
Object¶
Index objects are responsible for holding the axis labels and other metadata (like the axis name or names). Any array or other sequence of labels you use when constructing a Series or DataFrame is internally converted to an Index:
In [47]:
obj = pd.Series(range(3), index=['a', 'b', 'c'])
index = obj.index
index
Out[47]:
Index(['a', 'b', 'c'], dtype='object')
In [48]:
index[1:]
Out[48]:
Index(['b', 'c'], dtype='object')
Index objects are immutable and thus can’t be modified by the user:
In [49]:
index[1] = 'd' # TypeError
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-49-c25f1f037188> in <module>()
----> 1 index[1] = 'd' # TypeError
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in __setitem__(self, key, value)
1722
1723 def __setitem__(self, key, value):
-> 1724 raise TypeError("Index does not support mutable operations")
1725
1726 def __getitem__(self, key):
TypeError: Index does not support mutable operations
Immutability makes it safer to share Index objects among data structures:
In [50]:
labels = pd.Index(np.arange(3))
labels
Out[50]:
Int64Index([0, 1, 2], dtype='int64')
In [51]:
obj2 = pd.Series([1.5, -2.5, 0], index=labels)
obj2
Out[51]:
0 1.5
1 -2.5
2 0.0
dtype: float64
In addition to being array-like, an Index also behaves like a fixed-size set:
In [52]:
frame3
Out[52]:
| state | Nevada | Ohio |
|---|---|---|
| year | ||
| 2000 | NaN | 1.5 |
| 2001 | 2.4 | 1.7 |
| 2002 | 2.9 | 3.6 |
In [53]:
frame3.columns
Out[53]:
Index(['Nevada', 'Ohio'], dtype='object', name='state')
In [54]:
'Ohio' in frame3.columns
Out[54]:
True
In [55]:
2003 in frame3.index
Out[55]:
False
Caution: Unlike Python sets, a pandas Index can contain duplicate labels:
In [56]:
dup_labels = pd.Index(['foo', 'foo', 'bar', 'bar'])
dup_labels
Out[56]:
Index(['foo', 'foo', 'bar', 'bar'], dtype='object')
Selections with duplicate labels will select all occurrences of that label.
Some Index
methods and properties¶
| Method | Description |
|---|---|
| append | Concatenate with additional Index objects, producing a new Index |
| difference | Compute set difference as an Index |
| intersection | Compute set intersection |
| union | Compute set union |
| isin | Compute boolean array indicating whether each value is contained in the passed collection |
| delete | Compute new Index with element at index i deleted |
| drop | Compute new Index by deleting passed values |
| insert | Compute new Index by inserting element at index i |
| is_monotonic | Returns True if each element is greater than or equal to the previous element |
| is_unique | Returns True if the Index has no duplicate values |
| unique | Compute the array of unique values in the Index |
For example:
In [57]:
indA = pd.Index([1, 3, 5, 7, 9])
indB = pd.Index([2, 3, 5, 7, 11])
indA.is_monotonic
Out[57]:
True
In [58]:
indA.intersection(indB)
Out[58]:
Int64Index([3, 5, 7], dtype='int64')
Essential Functionality¶
As throughout this class, we’ll focus on the most important features, leaving the less common (i.e., more esoteric) things for you to explore on your own.
Reindexing¶
An important method on pandas objects is reindex
, which means to
create a new object with the data conformed to a new index. Consider
an example:
In [59]:
obj = pd.Series([4.5, 7.2, -5.3, 3.6], index=['d', 'b', 'a', 'c'])
obj
Out[59]:
d 4.5
b 7.2
a -5.3
c 3.6
dtype: float64
Calling reindex
on this Series rearranges the data according to the
new index, introducing missing values if any index values were not
already present:
In [60]:
obj2 = obj.reindex(['a', 'b', 'c', 'd', 'e'])
obj2
Out[60]:
a -5.3
b 7.2
c 3.6
d 4.5
e NaN
dtype: float64
For ordered data like time series, it may be desirable to do some
interpolation or filling of values when reindexing. The method option
allows us to do this, using a method such as ffill
, which
forward-fills the values:
In [61]:
obj3 = pd.Series(['blue', 'purple', 'yellow'], index=[0, 2, 4])
obj3
Out[61]:
0 blue
2 purple
4 yellow
dtype: object
In [62]:
obj3.reindex(range(6), method='ffill')
Out[62]:
0 blue
1 blue
2 purple
3 purple
4 yellow
5 yellow
dtype: object
In [63]:
# We can also backfill
obj3.reindex(range(6), method='bfill')
Out[63]:
0 blue
1 purple
2 purple
3 yellow
4 yellow
5 NaN
dtype: object
In [64]:
# or fill with a specified value
obj3.reindex(range(6), fill_value='white')
Out[64]:
0 blue
1 white
2 purple
3 white
4 yellow
5 white
dtype: object
With DataFrame, reindex can alter either the (row) index, columns, or both. When passed only a sequence, it reindexes the rows in the result:
In [65]:
frame = pd.DataFrame(np.arange(9).reshape((3, 3)),
index=['a', 'c', 'd'],
columns=['Ohio', 'Texas', 'California'])
frame
Out[65]:
| Ohio | Texas | California | |
|---|---|---|---|
| a | 0 | 1 | 2 |
| c | 3 | 4 | 5 |
| d | 6 | 7 | 8 |
In [66]:
frame2 = frame.reindex(['a', 'b', 'c', 'd'])
frame2
Out[66]:
| Ohio | Texas | California | |
|---|---|---|---|
| a | 0.0 | 1.0 | 2.0 |
| b | NaN | NaN | NaN |
| c | 3.0 | 4.0 | 5.0 |
| d | 6.0 | 7.0 | 8.0 |
The columns can be reindexed with the columns keyword:
In [67]:
states = ['Texas', 'Utah', 'California']
frame.reindex(columns=states)
Out[67]:
| Texas | Utah | California | |
|---|---|---|---|
| a | 1 | NaN | 2 |
| c | 4 | NaN | 5 |
| d | 7 | NaN | 8 |
Dropping Entries from an Axis¶
Dropping one or more entries from an axis is easy if you already have an index array or list without those entries. As that can require a bit of munging and set logic, the drop method will return a new object with the indicated value or values deleted from an axis:
In [68]:
obj = pd.Series(np.arange(5.), index=['a', 'b', 'c', 'd', 'e'])
obj
Out[68]:
a 0.0
b 1.0
c 2.0
d 3.0
e 4.0
dtype: float64
In [69]:
new_obj = obj.drop('c')
new_obj
Out[69]:
a 0.0
b 1.0
d 3.0
e 4.0
dtype: float64
In [70]:
obj.drop(['d', 'c'])
Out[70]:
a 0.0
b 1.0
e 4.0
dtype: float64
With DataFrame, index values can be deleted from either axis. To illustrate this, we first create an example DataFrame:
In [71]:
data = pd.DataFrame(np.arange(16).reshape((4, 4)),
index=['Ohio', 'Colorado', 'Utah', 'New York'],
columns=['one', 'two', 'three', 'four'])
data
Out[71]:
| one | two | three | four | |
|---|---|---|---|---|
| Ohio | 0 | 1 | 2 | 3 |
| Colorado | 4 | 5 | 6 | 7 |
| Utah | 8 | 9 | 10 | 11 |
| New York | 12 | 13 | 14 | 15 |
Calling drop
with a sequence of labels will drop values from the row
labels (axis 0):
In [72]:
data.drop(['Colorado', 'Ohio'])
Out[72]:
| one | two | three | four | |
|---|---|---|---|---|
| Utah | 8 | 9 | 10 | 11 |
| New York | 12 | 13 | 14 | 15 |
You can drop values from the columns by passing axis=1 or axis=‘columns’:
In [73]:
data.drop('two', axis=1)
Out[73]:
| one | three | four | |
|---|---|---|---|
| Ohio | 0 | 2 | 3 |
| Colorado | 4 | 6 | 7 |
| Utah | 8 | 10 | 11 |
| New York | 12 | 14 | 15 |
In [74]:
data.drop(['two', 'four'], axis='columns')
Out[74]:
| one | three | |
|---|---|---|
| Ohio | 0 | 2 |
| Colorado | 4 | 6 |
| Utah | 8 | 10 |
| New York | 12 | 14 |
Many functions, like drop, which modify the size or shape of a Series or DataFrame, can manipulate an object in-place without returning a new object:
In [75]:
obj.drop('c', inplace=True)
obj
Out[75]:
a 0.0
b 1.0
d 3.0
e 4.0
dtype: float64
Be careful with the inplace, as it destroys any data that is dropped.
Indexing, Selection, and Filtering¶
Series indexing (obj[…]) works analogously to NumPy array indexing, except you can use the Series’s index values instead of only integers. Here are some examples of this:
In [76]:
obj = pd.Series(np.arange(4.), index=['a', 'b', 'c', 'd'])
obj
Out[76]:
a 0.0
b 1.0
c 2.0
d 3.0
dtype: float64
In [77]:
obj['b']
Out[77]:
1.0
In [78]:
obj[1]
Out[78]:
1.0
In [79]:
obj[2:4]
Out[79]:
c 2.0
d 3.0
dtype: float64
In [80]:
obj[['b', 'a', 'd']]
Out[80]:
b 1.0
a 0.0
d 3.0
dtype: float64
In [81]:
obj[[1, 3]]
Out[81]:
b 1.0
d 3.0
dtype: float64
In [82]:
obj[obj < 2]
Out[82]:
a 0.0
b 1.0
dtype: float64
Caution: Slicing with labels behaves differently than normal Python slicing in that the endpoint is inclusive:
In [83]:
obj['b':'c']
Out[83]:
b 1.0
c 2.0
dtype: float64
Setting using these methods modifies the corresponding section of the Series:
In [84]:
obj['b':'c'] = 5
obj
Out[84]:
a 0.0
b 5.0
c 5.0
d 3.0
dtype: float64
Indexing into a DataFrame is for retrieving one or more columns either with a single value or sequence:
In [85]:
data = pd.DataFrame(np.arange(16).reshape((4, 4)),
index=['Ohio', 'Colorado', 'Utah', 'New York'],
columns=['one', 'two', 'three', 'four'])
data
Out[85]:
| one | two | three | four | |
|---|---|---|---|---|
| Ohio | 0 | 1 | 2 | 3 |
| Colorado | 4 | 5 | 6 | 7 |
| Utah | 8 | 9 | 10 | 11 |
| New York | 12 | 13 | 14 | 15 |
In [86]:
data['two']
Out[86]:
Ohio 1
Colorado 5
Utah 9
New York 13
Name: two, dtype: int64
In [87]:
data[['three', 'one']]
Out[87]:
| three | one | |
|---|---|---|
| Ohio | 2 | 0 |
| Colorado | 6 | 4 |
| Utah | 10 | 8 |
| New York | 14 | 12 |
Selection with loc
and iloc
¶
These slicing and indexing conventions can be a source of confusion. For
example, if your Series
has an explicit integer index, an indexing
operation such as data[1]
will use the explicit indices, while a
slicing operation like data[1:3]
will use the implicit Python-style
index.
In [88]:
data = pd.Series(['a', 'b', 'c'], index=[1, 3, 5])
data
Out[88]:
1 a
3 b
5 c
dtype: object
In [89]:
# explicit index when indexing
data[1]
Out[89]:
'a'
In [90]:
# implicit index when slicing
data[1:3]
Out[90]:
3 b
5 c
dtype: object
Because of this potential confusion in the case of integer indexes,
Pandas provides some special indexer attributes that explicitly expose
certain indexing schemes. These are not functional methods, but
attributes that expose a particular slicing interface to the data in the
Series
.
First, the loc
attribute allows indexing and slicing that always
references the explicit index:
In [91]:
data.loc[1]
Out[91]:
'a'
In [92]:
data.loc[1:3]
Out[92]:
1 a
3 b
dtype: object
The iloc
attribute allows indexing and slicing that always
references the implicit Python-style index:
In [93]:
data.iloc[1]
Out[93]:
'b'
In [94]:
data.iloc[1:3]
Out[94]:
3 b
5 c
dtype: object
One guiding principle of Python code is that “explicit is better than
implicit.” The explicit nature of loc
and iloc
make them very
useful in maintaining clean and readable code; especially in the case of
integer indexes, I recommend using these both to make code easier to
read and understand, and to prevent subtle bugs due to the mixed
indexing/slicing convention.
Data Selection in DataFrame¶
Recall that a DataFrame
acts in many ways like a two-dimensional or
structured array, and in other ways like a dictionary of Series
structures sharing the same index. These analogies can be helpful to
keep in mind as we explore data selection within this structure.
DataFrame as a dictionary¶
The first analogy we will consider is the DataFrame
as a dictionary
of related Series
objects. Let’s return to our example of areas and
populations of states:
In [95]:
area = pd.Series({'California': 423967, 'Texas': 695662,
'New York': 141297, 'Florida': 170312,
'Illinois': 149995})
pop = pd.Series({'California': 38332521, 'Texas': 26448193,
'New York': 19651127, 'Florida': 19552860,
'Illinois': 12882135})
data = pd.DataFrame({'area':area, 'pop':pop})
data
Out[95]:
| area | pop | |
|---|---|---|
| California | 423967 | 38332521 |
| Florida | 170312 | 19552860 |
| Illinois | 149995 | 12882135 |
| New York | 141297 | 19651127 |
| Texas | 695662 | 26448193 |
The individual Series
that make up the columns of the DataFrame
can be accessed via dictionary-style indexing of the column name:
In [96]:
data['area']
Out[96]:
California 423967
Florida 170312
Illinois 149995
New York 141297
Texas 695662
Name: area, dtype: int64
Equivalently, we can use attribute-style access with column names that are strings:
In [97]:
data.area
Out[97]:
California 423967
Florida 170312
Illinois 149995
New York 141297
Texas 695662
Name: area, dtype: int64
This attribute-style column access actually accesses the exact same object as the dictionary-style access:
In [98]:
data.area is data['area']
Out[98]:
True
Though this is a useful shorthand, keep in mind that it does not work
for all cases! For example, if the column names are not strings, or if
the column names conflict with methods of the DataFrame
, this
attribute-style access is not possible. For example, the DataFrame
has a pop()
method, so data.pop
will point to this rather than
the "pop"
column:
In [99]:
data.pop is data['pop']
Out[99]:
False
In particular, you should avoid the temptation to try column assignment
via attribute (i.e., use data['pop'] = z
rather than
data.pop = z
).
Like with the Series
objects discussed earlier, this
dictionary-style syntax can also be used to modify the object, in this
case adding a new column:
In [100]:
data['density'] = data['pop'] / data['area']
data
Out[100]:
| area | pop | density | |
|---|---|---|---|
| California | 423967 | 38332521 | 90.413926 |
| Florida | 170312 | 19552860 | 114.806121 |
| Illinois | 149995 | 12882135 | 85.883763 |
| New York | 141297 | 19651127 | 139.076746 |
| Texas | 695662 | 26448193 | 38.018740 |
This shows a preview of the straightforward syntax of element-by-element
arithmetic between Series
objects; we’ll dig into this further in
the next topic, Operating on Data in Pandas.
DataFrame as two-dimensional array¶
As mentioned previously, we can also view the DataFrame
as an
enhanced two-dimensional array. We can examine the raw underlying data
array using the values
attribute:
In [101]:
data.values
Out[101]:
array([[ 4.23967000e+05, 3.83325210e+07, 9.04139261e+01],
[ 1.70312000e+05, 1.95528600e+07, 1.14806121e+02],
[ 1.49995000e+05, 1.28821350e+07, 8.58837628e+01],
[ 1.41297000e+05, 1.96511270e+07, 1.39076746e+02],
[ 6.95662000e+05, 2.64481930e+07, 3.80187404e+01]])
With this picture in mind, many familiar array-like observations can be
done on the DataFrame
itself. For example, we can transpose the full
DataFrame
to swap rows and columns:
In [102]:
data.T
Out[102]:
| California | Florida | Illinois | New York | Texas | |
|---|---|---|---|---|---|
| area | 4.239670e+05 | 1.703120e+05 | 1.499950e+05 | 1.412970e+05 | 6.956620e+05 |
| pop | 3.833252e+07 | 1.955286e+07 | 1.288214e+07 | 1.965113e+07 | 2.644819e+07 |
| density | 9.041393e+01 | 1.148061e+02 | 8.588376e+01 | 1.390767e+02 | 3.801874e+01 |
When it comes to indexing of DataFrame
objects, however, it is clear
that the dictionary-style indexing of columns precludes our ability to
simply treat it as a NumPy array. In particular, passing a single index
to an array accesses a row:
In [103]:
data.values[0]
Out[103]:
array([ 4.23967000e+05, 3.83325210e+07, 9.04139261e+01])
and passing a single “index” to a DataFrame
accesses a column:
In [104]:
data['area']
Out[104]:
California 423967
Florida 170312
Illinois 149995
New York 141297
Texas 695662
Name: area, dtype: int64
Thus for array-style indexing, we need another convention. Here Pandas
again uses the loc
, iloc
, and ix
indexers mentioned earlier.
Using the iloc
indexer, we can index the underlying array as if it
is a simple NumPy array (using the implicit Python-style index), but the
DataFrame
index and column labels are maintained in the result:
In [105]:
data.iloc[:3, :2]
Out[105]:
| area | pop | |
|---|---|---|
| California | 423967 | 38332521 |
| Florida | 170312 | 19552860 |
| Illinois | 149995 | 12882135 |
Similarly, using the loc
indexer we can index the underlying data in
an array-like style but using the explicit index and column names:
In [106]:
data.loc[:'Illinois', :'pop']
Out[106]:
| area | pop | |
|---|---|---|
| California | 423967 | 38332521 |
| Florida | 170312 | 19552860 |
| Illinois | 149995 | 12882135 |
Any of the familiar NumPy-style data access patterns can be used within
these indexers. For example, in the loc
indexer we can combine
masking and fancy indexing as in the following:
In [107]:
data.loc[data.density > 100, ['pop', 'density']]
Out[107]:
| pop | density | |
|---|---|---|
| Florida | 19552860 | 114.806121 |
| New York | 19651127 | 139.076746 |
Any of these indexing conventions may also be used to set or modify values; this is done in the standard way that you might be accustomed to from working with NumPy:
In [108]:
data.iloc[0, 2] = 90
data
Out[108]:
| area | pop | density | |
|---|---|---|---|
| California | 423967 | 38332521 | 90.000000 |
| Florida | 170312 | 19552860 | 114.806121 |
| Illinois | 149995 | 12882135 | 85.883763 |
| New York | 141297 | 19651127 | 139.076746 |
| Texas | 695662 | 26448193 | 38.018740 |
| Type | Notes |
|---|---|
| df[val] | Select single column or sequence of columns from the DataFrame; special case conveniences: boolean array (filter rows), slice (slice rows), or boolean DataFrame (set values based on some criterion) |
| df.loc[val] | Selects single row or subset of rows from the DataFrame by label |
| df.loc[:, val] | Selects single column or subset of columns by label |
| df.loc[val1, val2] | Select both rows and columns by label |
| df.iloc[where] | Selects single row or subset of rows from the DataFrame by integer position |
| df.iloc[:, where] | Selects single column or subset of columns by integer position |
| df.iloc[where_i, where_j] | Select both rows and columns by integer position |
| df.at[label_i, label_j] | Select a single scalar value by row and column label |
| df.iat[i, j] | Select a single scalar value by row and column position (integers) |
| reindex method | Select either rows or columns by labels |
| get_value, set_value methods | Select single value by row and column label |
Integer Indexes¶
Working with pandas objects indexed by integers is something that often trips up new users due to some differences with indexing semantics on built-in Python data structures like lists and tuples. For example, you might not expect the following code to generate an error:
In [109]:
ser = pd.Series(np.arange(3.))
ser
ser[-1]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-109-cf4c324dfe44> in <module>()
1 ser = pd.Series(np.arange(3.))
2 ser
----> 3 ser[-1]
~/.local/lib/python3.6/site-packages/pandas/core/series.py in __getitem__(self, key)
621 key = com._apply_if_callable(key, self)
622 try:
--> 623 result = self.index.get_value(self, key)
624
625 if not is_scalar(result):
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_value(self, series, key)
2555 try:
2556 return self._engine.get_value(s, k,
-> 2557 tz=getattr(series.dtype, 'tz', None))
2558 except KeyError as e1:
2559 if len(self) > 0 and self.inferred_type in ['integer', 'boolean']:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
KeyError: -1
In this case, pandas could “fall back” on integer indexing, but it’s difficult to do this in general without introducing subtle bugs. Here we have an index containing 0, 1, 2, but inferring what the user wants (label-based indexing or position-based) is difficult. On the other hand, with a non-integer index, there is no potential for ambiguity:
In [110]:
ser2 = pd.Series(np.arange(3.), index=['a', 'b', 'c'])
ser2[-1]
Out[110]:
2.0
To keep things consistent, if you have an axis index containing integers, data selection will always be label-oriented. For more precise handling, use loc (for labels) or iloc (for integers):
In [111]:
ser[:1]
Out[111]:
0 0.0
dtype: float64
In [112]:
ser.loc[:1]
Out[112]:
0 0.0
1 1.0
dtype: float64
In [113]:
ser.iloc[:1]
Out[113]:
0 0.0
dtype: float64
Operating on Data in Pandas¶
One of the essential pieces of NumPy is the ability to perform quick element-wise operations, both with basic arithmetic (addition, subtraction, multiplication, etc.) and with more sophisticated operations (trigonometric functions, exponential and logarithmic functions, etc.). Pandas inherits much of this functionality from NumPy.
Pandas includes a couple useful twists, however: for unary operations
like negation and trigonometric functions, these functions will
preserve index and column labels in the output, and for binary
operations such as addition and multiplication, Pandas will
automatically align indices when passing the objects to the function.
This means that keeping the context of data and combining data from
different sources–both potentially error-prone tasks with raw NumPy
arrays–become essentially foolproof ones with Pandas. We will
additionally see that there are well-defined operations between
one-dimensional Series
structures and two-dimensional DataFrame
structures.
Because Pandas is designed to work with NumPy, any NumPy function will
work on Pandas Series
and DataFrame
objects. Let’s start by
defining a simple Series
and DataFrame
on which to demonstrate
this:
In [114]:
rng = np.random.RandomState(42)
ser = pd.Series(rng.randint(0, 10, 4))
ser
Out[114]:
0 6
1 3
2 7
3 4
dtype: int64
In [115]:
df = pd.DataFrame(rng.randint(0, 10, (3, 4)),
columns=['A', 'B', 'C', 'D'])
df
Out[115]:
| A | B | C | D | |
|---|---|---|---|---|
| 0 | 6 | 9 | 2 | 6 |
| 1 | 7 | 4 | 3 | 7 |
| 2 | 7 | 2 | 5 | 4 |
If we apply a NumPy function on either of these objects, the result will be another Pandas object with the indices preserved:
In [116]:
np.exp(ser)
Out[116]:
0 403.428793
1 20.085537
2 1096.633158
3 54.598150
dtype: float64
Or, for a slightly more complex calculation:
In [117]:
np.sin(df * np.pi / 4)
Out[117]:
| A | B | C | D | |
|---|---|---|---|---|
| 0 | -1.000000 | 7.071068e-01 | 1.000000 | -1.000000e+00 |
| 1 | -0.707107 | 1.224647e-16 | 0.707107 | -7.071068e-01 |
| 2 | -0.707107 | 1.000000e+00 | -0.707107 | 1.224647e-16 |
For binary operations on two Series
or DataFrame
objects, Pandas
will align indices in the process of performing the operation. This is
very convenient when working with incomplete data, as we’ll see in some
of the examples that follow.
Index alignment in Series¶
As an example, suppose we are combining two different data sources, and find only the top three US states by area and the top three US states by population:
In [118]:
area = pd.Series({'Alaska': 1723337, 'Texas': 695662,
'California': 423967}, name='area')
population = pd.Series({'California': 38332521, 'Texas': 26448193,
'New York': 19651127}, name='population')
Let’s see what happens when we divide these to compute the population density:
In [119]:
population / area
Out[119]:
Alaska NaN
California 90.413926
New York NaN
Texas 38.018740
dtype: float64
The resulting array contains the union of indices of the two input arrays, which could be determined using standard Python set arithmetic on these indices:
In [120]:
area.index | population.index
Out[120]:
Index(['Alaska', 'California', 'New York', 'Texas'], dtype='object')
Any item for which one or the other does not have an entry is marked
with NaN
, or “Not a Number,” which is how Pandas marks missing data
(we’ll come back to missing data). This index matching is implemented
this way for any of Python’s built-in arithmetic expressions; any
missing values are filled in with NaN by default:
In [121]:
A = pd.Series([2, 4, 6], index=[0, 1, 2])
B = pd.Series([1, 3, 5], index=[1, 2, 3])
A + B
Out[121]:
0 NaN
1 5.0
2 9.0
3 NaN
dtype: float64
If using NaN values is not the desired behavior, the fill value can be
modified using appropriate object methods in place of the operators. For
example, calling A.add(B)
is equivalent to calling A + B
, but
allows optional explicit specification of the fill value for any
elements in A
or B
that might be missing:
In [122]:
A.add(B, fill_value=0)
Out[122]:
0 2.0
1 5.0
2 9.0
3 5.0
dtype: float64
Index alignment in DataFrame¶
A similar type of alignment takes place for both columns and indices
when performing operations on DataFrame
s:
In [123]:
A = pd.DataFrame(rng.randint(0, 20, (2, 2)),
columns=list('AB'))
A
Out[123]:
| A | B | |
|---|---|---|
| 0 | 1 | 11 |
| 1 | 5 | 1 |
In [124]:
B = pd.DataFrame(rng.randint(0, 10, (3, 3)),
columns=list('BAC'))
B
Out[124]:
| B | A | C | |
|---|---|---|---|
| 0 | 4 | 0 | 9 |
| 1 | 5 | 8 | 0 |
| 2 | 9 | 2 | 6 |
In [125]:
A + B
Out[125]:
| A | B | C | |
|---|---|---|---|
| 0 | 1.0 | 15.0 | NaN |
| 1 | 13.0 | 6.0 | NaN |
| 2 | NaN | NaN | NaN |
Notice that indices are aligned correctly irrespective of their order in
the two objects, and indices in the result are sorted. As was the case
with Series
, we can use the associated object’s arithmetic method
and pass any desired fill_value
to be used in place of missing
entries. Here we’ll fill with the mean of all values in A
(computed
by first stacking the rows of A
):
In [126]:
fill = A.stack().mean()
print(fill)
4.5
In [127]:
A.add(B, fill_value=fill)
Out[127]:
| A | B | C | |
|---|---|---|---|
| 0 | 1.0 | 15.0 | 13.5 |
| 1 | 13.0 | 6.0 | 4.5 |
| 2 | 6.5 | 13.5 | 10.5 |
Operations Between DataFrame and Series¶
When performing operations between a DataFrame
and a Series
, the
index and column alignment is similarly maintained. Operations between a
DataFrame
and a Series
are similar to operations between a
two-dimensional and one-dimensional NumPy array. Consider one common
operation, where we find the difference of a two-dimensional array and
one of its rows:
In [128]:
A = rng.randint(10, size=(3, 4))
A
Out[128]:
array([[3, 8, 2, 4],
[2, 6, 4, 8],
[6, 1, 3, 8]])
In [129]:
A - A[0]
Out[129]:
array([[ 0, 0, 0, 0],
[-1, -2, 2, 4],
[ 3, -7, 1, 4]])
According to NumPy’s broadcasting rules, subtraction between a two-dimensional array and one of its rows is applied row-wise.
In Pandas, the convention similarly operates row-wise by default:
In [130]:
df = pd.DataFrame(A, columns=list('QRST'))
df - df.iloc[0]
Out[130]:
| Q | R | S | T | |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | -1 | -2 | 2 | 4 |
| 2 | 3 | -7 | 1 | 4 |
If you would instead like to operate column-wise, you can use the object
methods mentioned earlier, while specifying the axis
keyword:
In [131]:
df.subtract(df['R'], axis=0)
Out[131]:
| Q | R | S | T | |
|---|---|---|---|---|
| 0 | -5 | 0 | -6 | -4 |
| 1 | -4 | 0 | -2 | 2 |
| 2 | 5 | 0 | 2 | 7 |
Note that these DataFrame
/Series
operations, like the operations
discussed above, will automatically align indices between the two
elements:
In [132]:
halfrow = df.iloc[0, ::2]
halfrow
Out[132]:
Q 3
S 2
Name: 0, dtype: int64
In [133]:
df - halfrow
Out[133]:
| Q | R | S | T | |
|---|---|---|---|---|
| 0 | 0.0 | NaN | 0.0 | NaN |
| 1 | -1.0 | NaN | 2.0 | NaN |
| 2 | 3.0 | NaN | 1.0 | NaN |
This preservation and alignment of indices and columns means that operations on data in Pandas will always maintain the data context, which prevents the types of silly errors that might come up when working with heterogeneous and/or misaligned data in raw NumPy arrays.
Handling Missing Data¶
The difference between data found in many tutorials and data in the real world is that real-world data is rarely clean and homogeneous. In particular, many interesting datasets will have some amount of data missing. To make matters even more complicated, different data sources may indicate missing data in different ways.
In this section, we will discuss some general considerations for missing data, discuss how Pandas chooses to represent it, and demonstrate some built-in Pandas tools for handling missing data in Python. Here and throughout the book, we’ll refer to missing data in general as null, NaN, or NA values.
There are a number of schemes that have been developed to indicate the presence of missing data in a table or DataFrame. Generally, they revolve around one of two strategies: using a mask that globally indicates missing values, or choosing a sentinel value that indicates a missing entry.
In the masking approach, the mask might be an entirely separate Boolean array, or it may involve appropriation of one bit in the data representation to locally indicate the null status of a value.
In the sentinel approach, the sentinel value could be some data-specific convention, such as indicating a missing integer value with -9999 or some rare bit pattern, or it could be a more global convention, such as indicating a missing floating-point value with NaN (Not a Number), a special value which is part of the IEEE floating-point specification.
None of these approaches is without trade-offs: use of a separate mask array requires allocation of an additional Boolean array, which adds overhead in both storage and computation. A sentinel value reduces the range of valid values that can be represented, and may require extra (often non-optimized) logic in CPU and GPU arithmetic. Common special values like NaN are not available for all data types.
As in most cases where no universally optimal choice exists, different languages and systems use different conventions. For example, the R language uses reserved bit patterns within each data type as sentinel values indicating missing data, while the SciDB system uses an extra byte attached to every cell which indicates a NA state.
The way in which Pandas handles missing values is constrained by its reliance on the NumPy package, which does not have a built-in notion of NA values for non-floating-point data types.
Pandas could have followed R’s lead in specifying bit patterns for each individual data type to indicate nullness, but this approach turns out to be rather unwieldy. While R contains four basic data types, NumPy supports far more than this: for example, while R has a single integer type, NumPy supports fourteen basic integer types once you account for available precisions, signedness, and endianness of the encoding. Reserving a specific bit pattern in all available NumPy types would lead to an unwieldy amount of overhead in special-casing various operations for various types, likely even requiring a new fork of the NumPy package. Further, for the smaller data types (such as 8-bit integers), sacrificing a bit to use as a mask will significantly reduce the range of values it can represent.
NumPy does have support for masked arrays – that is, arrays that have a separate Boolean mask array attached for marking data as “good” or “bad.” Pandas could have derived from this, but the overhead in both storage, computation, and code maintenance makes that an unattractive choice.
With these constraints in mind, Pandas chose to use sentinels for
missing data, and further chose to use two already-existing Python null
values: the special floating-point NaN
value, and the Python
None
object. This choice has some side effects, as we will see, but
in practice ends up being a good compromise in most cases of interest.
None
: Pythonic missing data¶
The first sentinel value used by Pandas is None
, a Python singleton
object that is often used for missing data in Python code. Because it is
a Python object, None
cannot be used in any arbitrary NumPy/Pandas
array, but only in arrays with data type 'object'
(i.e., arrays of
Python objects):
In [134]:
vals1 = np.array([1, None, 3, 4])
vals1
Out[134]:
array([1, None, 3, 4], dtype=object)
This dtype=object
means that the best common type representation
NumPy could infer for the contents of the array is that they are Python
objects. While this kind of object array is useful for some purposes,
any operations on the data will be done at the Python level, with much
more overhead than the typically fast operations seen for arrays with
native types:
In [135]:
for dtype in ['object', 'int']:
print("dtype =", dtype)
%timeit np.arange(1E6, dtype=dtype).sum()
print()
dtype = object
70.6 ms ± 483 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
dtype = int
761 µs ± 11.1 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
The use of Python objects in an array also means that if you perform
aggregations like sum()
or min()
across an array with a None
value, you will generally get an error:
In [136]:
vals1.sum()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-136-749fd8ae6030> in <module>()
----> 1 vals1.sum()
~/.local/lib/python3.6/site-packages/numpy/core/_methods.py in _sum(a, axis, dtype, out, keepdims)
30
31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
---> 32 return umr_sum(a, axis, dtype, out, keepdims)
33
34 def _prod(a, axis=None, dtype=None, out=None, keepdims=False):
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
This reflects the fact that addition between an integer and None
is
undefined.
NaN
: Missing numerical data¶
The other missing data representation, NaN
(acronym for Not a
Number), is different; it is a special floating-point value recognized
by all systems that use the standard IEEE floating-point representation:
In [137]:
vals2 = np.array([1, np.nan, 3, 4])
vals2.dtype
Out[137]:
dtype('float64')
Keep in mind that NaN
is specifically a floating-point value; there
is no equivalent NaN value for integers, strings, or other types.
NaN and None in Pandas¶
NaN
and None
both have their place, and Pandas is built to
handle the two of them nearly interchangeably, converting between them
where appropriate:
In [138]:
pd.Series([1, np.nan, 2, None])
Out[138]:
0 1.0
1 NaN
2 2.0
3 NaN
dtype: float64
For types that don’t have an available sentinel value, Pandas
automatically type-casts when NA values are present. For example, if we
set a value in an integer array to np.nan
, it will automatically be
upcast to a floating-point type to accommodate the NA:
In [139]:
x = pd.Series(range(2), dtype=int)
x
Out[139]:
0 0
1 1
dtype: int64
In [140]:
x[0] = None
x
Out[140]:
0 NaN
1 1.0
dtype: float64
Notice that in addition to casting the integer array to floating point,
Pandas automatically converts the None
to a NaN
value. (Be aware
that there is a proposal to add a native integer NA to Pandas in the
future; as of this writing, it has not been included).
While this type of magic may feel a bit hackish compared to the more unified approach to NA values in domain-specific languages like R, the Pandas sentinel/casting approach works quite well in practice and in my experience only rarely causes issues.
The following table lists the upcasting conventions in Pandas when NA values are introduced:
| Typeclass | Conversion When Storing NAs | NA Sentinel Value |
|---|---|---|
floating |
No change | np.nan |
object |
No change | None or np.nan |
integer |
Cast to float64 |
np.nan |
boolean |
Cast to object |
None or np.nan |
Keep in mind that in Pandas, string data is always stored with an
object
dtype.
Operating on Null Values¶
As we have seen, Pandas treats None
and NaN
as essentially
interchangeable for indicating missing or null values. To facilitate
this convention, there are several useful methods for detecting,
removing, and replacing null values in Pandas data structures. They are:
isnull()
: Generate a boolean mask indicating missing valuesnotnull()
: Opposite ofisnull()
dropna()
: Return a filtered version of the datafillna()
: Return a copy of the data with missing values filled or imputed
We will conclude this section with a brief exploration and demonstration of these routines.
Detecting null values¶
Pandas data structures have two useful methods for detecting null data:
isnull()
and notnull()
. Either one will return a Boolean mask
over the data. For example:
In [141]:
data = pd.Series([1, np.nan, 'hello', None])
data
Out[141]:
0 1
1 NaN
2 hello
3 None
dtype: object
In [142]:
data.isnull()
Out[142]:
0 False
1 True
2 False
3 True
dtype: bool
Boolean masks can be used directly as a Series
or DataFrame
index:
In [143]:
data[data.notnull()]
Out[143]:
0 1
2 hello
dtype: object
The isnull()
and notnull()
methods produce similar Boolean
results for DataFrame
s.
Dropping null values¶
In addition to the masking used before, there are the convenience
methods, dropna()
(which removes NA values) and fillna()
(which
fills in NA values). For a Series
, the result is straightforward:
In [144]:
data.dropna()
Out[144]:
0 1
2 hello
dtype: object
For a DataFrame
, there are more options. Consider the following
DataFrame
:
In [145]:
df = pd.DataFrame([[1, np.nan, 2],
[2, 3, 5],
[np.nan, 4, 6]])
df
Out[145]:
| 0 | 1 | 2 | |
|---|---|---|---|
| 0 | 1.0 | NaN | 2 |
| 1 | 2.0 | 3.0 | 5 |
| 2 | NaN | 4.0 | 6 |
We cannot drop single values from a DataFrame
; we can only drop full
rows or full columns. Depending on the application, you might want one
or the other, so dropna()
gives a number of options for a
DataFrame
.
By default, dropna()
will drop all rows in which any null value is
present:
In [146]:
df.dropna()
Out[146]:
| 0 | 1 | 2 | |
|---|---|---|---|
| 1 | 2.0 | 3.0 | 5 |
Alternatively, you can drop NA values along a different axis; axis=1
drops all columns containing a null value:
In [147]:
df.dropna(axis='columns')
Out[147]:
| 2 | |
|---|---|
| 0 | 2 |
| 1 | 5 |
| 2 | 6 |
But this drops some good data as well; you might rather be interested in
dropping rows or columns with all NA values, or a majority of NA
values. This can be specified through the how
or thresh
parameters, which allow fine control of the number of nulls to allow
through.
The default is how='any'
, such that any row or column (depending on
the axis
keyword) containing a null value will be dropped. You can
also specify how='all'
, which will only drop rows/columns that are
all null values:
In [148]:
df[3] = np.nan
df
Out[148]:
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 0 | 1.0 | NaN | 2 | NaN |
| 1 | 2.0 | 3.0 | 5 | NaN |
| 2 | NaN | 4.0 | 6 | NaN |
In [149]:
df.dropna(axis='columns', how='all')
Out[149]:
| 0 | 1 | 2 | |
|---|---|---|---|
| 0 | 1.0 | NaN | 2 |
| 1 | 2.0 | 3.0 | 5 |
| 2 | NaN | 4.0 | 6 |
For finer-grained control, the thresh
parameter lets you specify a
minimum number of non-null values for the row/column to be kept:
In [150]:
df.dropna(axis='rows', thresh=3)
Out[150]:
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 1 | 2.0 | 3.0 | 5 | NaN |
In [151]:
data.fillna(0)
# back-fill
data.fillna(method='bfill')
Out[151]:
0 1
1 hello
2 hello
3 None
dtype: object
We can specify a forward-fill to propagate the previous value forward:
In [152]:
# forward-fill
data.fillna(method='ffill')
Out[152]:
0 1
1 1
2 hello
3 hello
dtype: object
Or we can specify a back-fill to propagate the next values backward:
In [153]:
# back-fill
data.fillna(method='bfill')
Out[153]:
0 1
1 hello
2 hello
3 None
dtype: object
Here the first and last row have been dropped, because they contain only two non-null values.
Filling null values¶
Sometimes rather than dropping NA values, you’d rather replace them with
a valid value. This value might be a single number like zero, or it
might be some sort of imputation or interpolation from the good values.
You could do this in-place using the isnull()
method as a mask, but
because it is such a common operation Pandas provides the fillna()
method, which returns a copy of the array with the null values replaced.
Consider the following Series
:
In [154]:
data = pd.Series([1, np.nan, 2, None, 3], index=list('abcde'))
data
Out[154]:
a 1.0
b NaN
c 2.0
d NaN
e 3.0
dtype: float64
We can fill NA entries with a single value, such as zero:
For DataFrame
s, the options are similar, but we can also specify
an axis
along which the fills take place:
In [155]:
df.fillna(method='ffill', axis=1)
Out[155]:
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 0 | 1.0 | 1.0 | 2.0 | 2.0 |
| 1 | 2.0 | 3.0 | 5.0 | 5.0 |
| 2 | NaN | 4.0 | 6.0 | 6.0 |


| | |
| 0 |
ingested 10x 0.25mg alprazolam tablets orally. |
| T + 5min |
feeling the effects coming up. warm feeling going up from legs. not very strong, but it feels nice. |
| T + 12min |
mild dizzines |
| T + 20min |
quite relaxed now, little problems with thinking |
| T + 25min |
when i turn my head, everything that i see comes a little 'late'. also hands feel very heavy |
| T + 35min |
time seems to go very fast. problems with coordination. little kind of same feeling when in drunk, but this is better and more 'clear' state |
| T + 40min |
stoned.. i found myself staring things. it feels hard to try stand straight. also being 'underwater' -feeling is present |
| T + 50min |
no problems understanding things what i heard from tv. i am very relaxed and i feel very heavy and same time i have feeling that i could just jump up and fly |
| T + 65min |
relaxed and little lazy to think anything. feeling that alprazolam is starting to come down. |
| T + 70min |
i walked a little. limbs are still feeling heavy, but not so much as earlier. also it feeled like i were walking on tiny needles (it doesn't hurt). |
| T + 80min |
relaxation and laziness that slides slowly away. to 200min. |
well.. it was nice experience with such a low dose. there were just a little euphoria and no ego loss at all, next time i'm going to try it with 7.5mg dose.
happy exploring!
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


a) Match Play. Red trails 3-4 to 5. Crawford Game. How should Red play 41?
pips Red=150 White=124
(CorrectAnswer= 0/0, ErrorScore= 0)
b) Money game. Cube owned by Red on 2. How should Red play 41?
In the match scenario Red must play to win the game as a loss means the loss of the match – gammons are irrelevant. Deciding on the best play to win the game is very difficult and certainly 9/5, 2/1* comes into consideration, aiming for a well-timed back game with chances to go forward but it turns out that trying to win by going forward immediately with 23/22, 5/1* is best while White still has two more blots.
For money Red must recognise he is likely to lose and should seek to limit gammon losses. He should play 23/22, 9/5. It wins very nearly the same amount of games as 23/22, 5/1* but loses fewer gammons.
In the match scenario Red must play to win the game as a loss means the loss of the match – gammons are irrelevant. Deciding on the best play to win the game is very difficult and certainly 9/5, 2/1* comes into consideration, aiming for a well-timed back game with chances to go forward but it turns out that trying to win by going forward immediately with 23/22, 5/1* is best while White still has two more blots.
For money Red must recognise he is likely to lose and should seek to limit gammon losses. He should play 23/22, 9/5. It wins very nearly the same amount of games as 23/22, 5/1* but loses fewer gammons.
1. Cubeful 2-ply 9/5 2/1* Eq.: -0.462 0.214 0.055 0.002 - 0.786 0.410 0.064 2. Cubeful 2-ply 23/22 5/1* Eq.: -0.464 (-0.003) 0.216 0.051 0.001 - 0.784 0.346 0.030 3. Cubeful 2-ply 23/22 9/5 Eq.: -0.478 (-0.016) 0.222 0.039 0.001 - 0.778 0.305 0.023 4. Cubeful 2-ply 24/23 5/1* Eq.: -0.535 (-0.073) 0.189 0.044 0.001 - 0.811 0.397 0.038 5. Cubeful 2-ply 24/23 9/5 Eq.: -0.543 (-0.081) 0.197 0.032 0.001 - 0.803 0.333 0.022


| waiterTheme {waiter} | R Documentation |
Define a theme to be used by all waiter loading screens. These can be overriden in individual loading screens.
waiter_set_theme(html = spin_1(), color = "#333e48", logo = "") waiter_get_theme() waiter_unset_theme()
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
logo |
Logo to display. |


Main
Registration
Player Evaluation ID
Sports Engine ID
First Name
Last Name
Take Player Photo
Player ID Missing or Not Valid
Saving Data ... Please Wait ...
Save Player


User Information
First name
Last name
User ID
Description
Select only one
Math
Physics
Select all that apply
Chemistry
Earth Science
Pick from the following
Maths
Physics
Billing Address
Address
City
Province
Postal Code
Where are you from?
Alabama
Alaska
Arizona
Alberta
British Columbia
Manitoba


"Get answers to your questions about how massage can help you."
Q. Why is massage good for me?
The short answer is, it makes you feel better!
The scientific answer is a bit longer... Whenever a person spends any length of time in a sustained posture or performing similar movements, muscular tone is increased and with increased muscular tone comes decreased blood flow and drainage of lymph (fluid that is not blood). As a result pain signals can be triggered causing the aches and pains we all experience from time to time. With injury this increase in tone is far greater, widespread and longer lasting.
Massage and manual manipulation attempts to restore healthy fluid dynamics to the tissues. When the fluid dynamics are improved so are the supply of nutrients and oxygen as well as the movement of metabolic waste products that can build up in the tissues.
Stimulation of tissues = improved fluid dynamics = healthy tissues and restored functionality, or massage = body feels good.
Q. Will just one massage be enough?
It always depends on the person and how long the condition has been there. The longer standing the condition the more treatments may be necessary, but most of my clients see me once a month or more.
Q. Do your treatments hurt?
It is necessary for best results to apply a certain amount of pressure to the tissues. If you are excessively tight or restricted in movement a small to medium level of discomfort is to be expected at various stages of the treatment, but I will ask you how it is feeling and adjust as necessary.
Q. Do I have to take off all my clothes to get a massage?
In most cases you are required to remove all clothing down to your underwear. However you will be covered by a towel the whole time. If you do not feel comfortable removing clothing, it is usually possible to treat using pressure through the clothing.
Q. Is there anything special I need to do before a massage? Or after?
It is important to keep your water intake up before and after a massage. The reason is that we are usually dealing with a dysfunctional fluid flow and the intention of a treatment is to restore fluid dynamics therefore drinking water before and after a treatment is an essential part of the treatment process. It is also important to avoid alcohol, coffee, and energy drinks after a treatment as these are diuretics and will encourage your body to get rid of the much needed water in the tissues. It’s a good idea to drink lots of water for the rest of the day to help flush the toxins out of the system too. When you come and see me, I’ll also give you some self help tips, which include things like stretches and specific exercises to work on your particular trouble area. You will be feeling better in no time!
Q. I’ve got sensitive skin. Will your massage oil irritate my skin?
The oil I use is high quality and does not cause a reaction for most people. However I can do most of the techniques without oil, using pressure and gentle stretching.
Got another question? Just ask.
Next: Check out some stretching videos for use after your treatment.


 That's a webpage. But how is a webpage made?
A Web page is code written in JavaScript, HTML, and CSS. Let's think about that code like a document written in a foreign language. If you were looking at a document written in German, you wouldn't know what it said in English... just like when you look at a page of HTML/CSS/JS you won't really know what the web page is going to look like. (Look at the picture of HTML below -- do you have any idea what that will turn into? Probably not!)
Luckily, just like you can use Google Translate to input a foreign language and get english in return, a browser takes the document full of code and turns it into the kind of webpage you're used to seeing.
The code above is actually the code for the New York Times website. Not even a professional programmer could have figured that out just by looking that that snippet of code -- that's what we have browsers for.
HTML, CSS, and JS are three different coding languages that do different things. They are the three, and only three, different programming languages that our browser knows how to turn into a web page. Most web pages that you see online use all three of them. Let's break it down:
HTML is everything on the page that you see, including words, images, links, and embedded content. The following page uses only HTML:
CSS controls how the HTML looks by changing the fonts, the text or background color, the alignment, etc. Here is the same webpage as before with CSS to make it prettier:
Did you notice anything different? (Hint: background color, content was centered, text color, font.) All of these changes were done using CSS.
JavaScript makes things happen. A webpage will remain exactly the same unless you use JavaScript. JavaScript also allows the user to interact with the webpage, by allowing you to trigger events. Here is the same page that has JS added:
Do you see how the background of the page is changing colors? That wouldn't be possible without JavaScript, because HTML/CSS can't change on their own. Also, did you try clicking on the icon? The title changes size because we told it in JavaScript that if the picture was clicked the title should grow.
How do you start coding?At this point you have a pretty good idea of how the web works and the differences between HTML, CSS, and JavaScript. Now, let's start coding in HTML.


Pursuing Bachelor's Of Technology in Metallurgy & Material Science Engineering
Passed intermediate from CBSE board with the 89% in Maths, Physics, Chemistry, English, Physical Education
I've good skills in programming, and keep better and better as the time going. I've done many projects in C, PHP, and in Web Development. And this website is a small part of it.
I always have a great affection towards physical fitness and games. I've great interest in cricket, badminton and table tennis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.


DSE 2019 - Course Links
Select Semester
Introduction slides are
here(from 2019)
. Guide for electives selection is
here(from 2015)
. More Info by SCIS
here
Initial Design and Code taken from :
Responsive Table Using Flexbox by Matt Nordstrom
Github repo:
https://github.com/umarhussain15/dse-2019


A C++ client for uploading documents to your Google Docs account.Introduction
My name is Michael Haephrati and this is my first article here. I wanted to write a small application which allows dragging and dropping multiple files and folders into a container in order to send them to an online storage. This article was written before Google introduced Google Drive, but it is still practical to use it for quick upload of multiple files to your Google Drive.
This article explains how to develop such an application that will use the free and the paid GoogleDocs service of storing documents and files online, allowing the end user to drag and drop files and entire folders and by doing so, backing up the selected files to a pre-defined GoogleDocs account.
Google Docs allows users to create and upload documents and files, work on them, and store them online. The service is free of charge; however, there are limitations which don’t exist when the paid service is used.
Google Docs Account Types
As described here, the free account type has its limitations when it comes to the types of files allowed to be uploaded. These limitations apply to the programmatic usage of the service, as opposed to using the online interface docs.google.com.
To lift some of the limitations, the end user should hold a Premier account. Users of the free account can only upload HTML, PDF, Word, Excel, PowerPoint, OpenOffice, text, and images.
Implementation
As a base, we have developed a class library named SmartHTTP.
1
2
3
4
5#define HTTP_POST_VERB L"POST" #define HTTP_CONTENT_LENGTH L"Content-Length" #define HTTP_CONTENT_TYPE L"Content-Type" #define HTTP_MIME_BINARY L"application/octet-stream" #define HTTP_MIME_FORM_URL_ENCODED L"application/x-www-form-urlencoded"
Connecting to the GoogleDocs server is done by using:
BOOL Connect(LPCTSTR szServerName, INTERNET_PORT nServerPort = INTERNET_DEFAULT_HTTP_PORT);
and the call:
1
2
3
4
5if (!m_internet.Connect(GOOGLE_LOGIN_SERVER, INTERNET_DEFAULT_HTTPS_PORT)) SetWinInetError(m_internet.GetError()); else { //... here we upload the documents, etc.
The Google Docs server is defined here:
GOOGLE_LOGIN_SERVER is L”www.google.com”
You may need to open an account with Google. A GMail account will do. If you are logged in, just go to http://docs.google.com
Basically, my application is a container to which files and entire folders can be dragged and dropped, causing all files within them, including files inside subfolders, to be sent to the GoogleDocs server. When the application is started, the container appears.
Closing it will send it to the IconTray. The Icon application's Tray Icon is used to display status messages during runtime. For example, when a file is dragged to the container, it is being added to the queue, and the following message appears:
About the conversion to Google Docs format
Google Docs offers documents uploaded to be converted to Google Docs format. This conversion is explained here. From my experience, some types of documents may get corrupted as a result of such conversion, especially Word documents in right to left languages (Arabic, Hebrew, etc.).
For that reason, I have added a checkbox to allow the end user to decide whether to convert or not.
But before the first file can be copied, the Settings dialog pops up allowing the end user to enter the Google Docs account details. In addition, the following options can be set:
Google Apps Premier Account- allows indicating the type of the account. List of Mirror Folders- allows adding (or deleting) local folders which will be mirrored at the server side keeping the structure of the files and folders under the given path. Recreate Folder Structure in Google Docs- when this option is set, documents are copied to a folder with the same name as the local one. Upload all Documents to the Root Google Docs folder- when this option is set, documents are copied to the root directory at the server side. Start Program on Windows Startup- launches DocsOnline when Windows starts.
Premier account holders can copy more types of files which are restricted for regular (free) accounts.
The logic behind my intuitive backupI believe applications and utilities should be intuitive and easy to use. For example, my application allows dragging and dropping folders, and by doing so, all files, and files within all subfolders, are backed up, after checking against previous copies already on the server. The logic I use for such "intuitive backup" is done using an examination of each file and a calculation of a hash which represents its contents. This logic addresses the following scenarios:
1. Different files having the same name - copy, but automatically generate a new name. Add a log entry.
2. Identical files having different names - add a log entry (in a later version, we shall unite such files in to a single one with a single name).
3. Identical files having the same name - skip.
Credits
The SystemTraySDK class class by Chris Maunder, used in my application, is a light wrapper around the Windows system tray stuff. It adds an icon to the system tray with the specified tooltip text and callback notification value, which is sent back to the parent window.
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
About the Author
Michael N. Haephrati, is an entrepreneur, inventor and a musician. Haephrati worked on many ventures starting from HarmonySoft, designing Rashumon, the first Graphical Multi-lingual word processor for Amiga computer. During 1995-1996 he worked as a Contractor with Apple at Cupertino. Worked at a research institute made the fist steps developing the credit scoring field in Israel. He founded Target Scoring and developed a credit scoring system named ThiS, based on geographical statistical data, participating VISA CAL, Isracard, Bank Leumi and Bank Discount (Target Scoring, being the VP Business Development of a large Israeli institute).
During 2000, he founded Target Eye, and developed the first remote PC surveillance and monitoring system, named Target Eye.
Other ventures included: Data Cleansing (as part of the DataTune system which was implemented in many organizations.
Follow @haephrati
Follow on Twitter, Google, LinkedIn
Article Top
Attachments: [DocsOnlinebyMichaelHaephratiSrc ] [one.zip] [two.zip]


feed reader testing
feed reader testing is a project based on a case which is needed to implement Jasmine testing framework to a web-based application that reads RSS feeds. The case is writing test suites according to expectations given.
Tech Used
- HTML5/CSS
- Javascript
- jQuery
- Jasmine
- Sublime Text 3
- Ajax


|
President & CEO Kazuyasu KAWAHARAWe aim to earn clients’ confidence by support and contribution to their business development. This is a challenging target.
It requires continuous learning and growth of every member. We encourage our staff to maintain strong spirit, continuously learn and growth, and become more professional through everyday tasks. We draw out these requirement for our staff:
- Always challenge with higher target
- Always work with heart
- Realize his contribution is also his gain
- Find happiness in challenges
|
|
|
- Overcome difficulty to grow
- Always listen, always improve together
With those become daily basic, we believe our proficiency will improve and we will get better everyday. The better our staff growth, the better we growth. Based on that, our support to your business will improve.
|


{% extends "base.html"%} {% block page-content_outer %}
Your username and password didn't match. Please try again.
IMPORT TEAM(S) / TEAMMEMBERS FROM EXCEL
(exact template match, unique email cmsuser)


These examples demonstrate a few simple Macker rules files. They include code and working Ant scripts, so you can futz with them as you like; they're under doc/example/
in the Macker distro. (You will need to get Ant version 1.5.) You can also just peruse the examples in your browser.
To try an example:
ant
" (presuming you have it).
exampledir/src/macker.xml
) and the source files. Fool around.
The examples all share some Ant targets from the file doc/example/build-shared.xml
, which you can adapt for your own projects.
Contains the not-very-practical basic example from the first section of the user's guide. Not a bad place to get started if you just want a working configuration to play with.
Demonstrates some rules for a layered (a.k.a. n-tiered, if you're into the business-speak) architecture. The sample code is split into GUI, model, and persistence classes with specific roles.
Demonstrates rules for componentized architecture in which two different pieces with parallel structures talk to one another through an API. Demonstrates how to use the <foreach>
tag.
Demonstrates rules for tying rules to implementation conventions, such as whether classes are final, or what implements what. Contains examples of patterns built with filters.


Man charged over Co Down ATM raid
by By Press AssociationA man has been charged over an attempted ATM theft that caused the collapse of a petrol station roof.
The suspect, 28, will appear at Downpatrick Magistrates’ Court on Thursday charged with burglary, criminal damage endangering life and aggravated vehicle taking causing damage to property, police said.
Thieves used a shovel/bulldozer-type vehicle stolen from a nearby quarry in a failed bid to rip the cash machine from the wall of Carlisles’ filling station in Ballynahinch, Co Down, at about 5.30am on Monday.
They struck the forecourt roof with the bucket of the vehicle as they tried to flee the scene.
It was one of a series of ATM raids on both sides over the border in recent days.
A woman, aged 22, arrested on suspicion of handling stolen goods and attempting to pervert the course of justice remains in police custody.
On Wednesday, a man aged 26 appeared in court in Newtownards in Co Down in connection with the attempted theft.
READ MORE
Maria Bailey seeks to 'correct' the record in letter to constituents


Whitman competes in Division III of the NCAA Northwest Conference in seven men's and eight women's athletic programs. Visit the Whitman Athletics website for news and information about Whitman's varsity athletics program. Recent headlines:
Whitman competes in Division III of the NCAA Northwest Conference in seven men's and eight women's athletic programs. Visit the Whitman Athletics website for news and information about Whitman's varsity athletics program. Recent headlines:


Campaign Term Deposit
Do you want to increase your tele-marketing conversion?  You can definitely achieve your goals by using our predictive analysis application.
Do you want to increase your tele-marketing conversion?  You can definitely achieve your goals by using our predictive analysis application.
We are a team of 4 enthusiastic people solving the problem UniBank is facing in promoting their new fixed deposit telemarketing campaign Team: Swetha Bobba Anusha Konatala Ravi Teja Kantheti Kovid Dev Reddy Nalla


Powerful image processing, simple API
imgix transforms, optimizes, and intelligently caches your entire image library for fast websites and apps using simple and robust URL parameters.
Over 100 real-time image operations, plus client libraries and CMS plugins for easy integrations with your product.
Serve optimized images to every device quickly with a worldwide CDN optimized for visual content.
We don’t charge to create variations of your Master Images. You can be as creative with the service as possible.
Billions of images served daily
Internet businesses of all sizes use imgix's robust infrastructure to power fast, crisp visual experiences for their customers.


General election 2019: Labour plans to teach British Empire injustice in schools
Children will be taught about injustice and the role of the British Empire as part of the national curriculum under Labour, the party says.
At the launch of his race and faith manifesto on Tuesday, Jeremy Corbyn will say a new trust will educate on how to address the legacy of slavery.
He will also set out policies on how to combat anti-Semitism in Britain.
The Tories said it was "staggering" to see Labour "lecture people" during a probe over claims of anti-Semitism.
But National Education Union joint general secretary Mary Bousted welcomed Labour's "set of joined-up proposals to proactively tackle racism".
Meanwhile, in a letter to the Times, Ephraim Mirvis, the Orthodox chief rabbi of Great Britain and Northern Ireland, has attacked the "utterly inadequate" response of the Labour leadership in dealing with anti-Semitism allegations.
He said there was anxiety in the Jewish community over a Labour government and he called on the public to "vote with their conscience".
At a launch event in Tottenham, north London, Mr Corbyn - with shadow women and equalities secretary Dawn Butler and shadow home secretary Diane Abbott - will launch the race and faith manifesto with pledges to improve social justice and human rights.
They will say that an "emancipation educational trust" would also be formed "to ensure historical injustice, colonialism and role of the British empire is taught in the national curriculum" if Labour wins the 12 December election.
The trust would educate on migration and how to address the legacy of slavery and teach how it "interrupted a rich and powerful black history".
The national curriculum will also be reviewed by the party to ensure it teaches children about racism, anti-Semitism, Islamophobia, xenophobia and black history, and to continue education about the Holocaust.
The party says it wants to extend pay gap reporting to BAME (black, Asian and minority ethnic) groups for businesses with 250 employees or more.
Labour's other proposals include:
- Creating a race equality unit within the Treasury, which will review major spending announcements for its impact on BAME communities
- Review "rip-off" charges for passports, visas and tests from the Home Office, with a view to lower the cost
- Review the under-representation of BAME teachers in schools
- An independent review of far-right extremism
On guaranteeing the security of the Jewish community, Labour says it will amend the law to include attacks on places of worship as a specific aggravated offence.
Labour has also pledged to work with social media platforms including Twitter, YouTube and Facebook "to combat the rise of anti-Semitism online".
"Labour has already been working with Facebook to take action against groups and individuals which have hijacked Labour's name to share anti-Semitic content," the party said.
The Equality and Human Rights Commission launched a formal investigation in May into the Labour Party over allegations of anti-Semitism.
It is formally looking into whether Labour has "unlawfully discriminated against, harassed or victimised people because they are Jewish".
At the time, Labour said the party was "anti-racist" and will "fully co-operate" with the investigation.
'Tackle barriers head-on'
Ahead of his speech at the Bernie Grant Arts Centre, Mr Corbyn said Labour "will do everything necessary to guarantee the security of the Jewish community, defend the Jewish way of life and the right to live it freely, and to combat rising anti-Semitism in our country and across Europe".
Mr Corbyn called Labour "the party of equality and human rights" and said it would "tackle head-on the barriers that have unfairly held back so many people and communities".
Ms Butler said: "Only by acknowledging the historical injustices faced by our communities can we work towards a better future that is prosperous for all, that isn't blighted by austerity and the politics of fear."
Conservative Home Secretary Priti Patel said it was "staggering" that Labour "sees fit to lecture people about race and faith" during the anti-Semitism investigation.
Dr Bousted said the National Education Union welcomed the proposal for a "new emancipation educational trust".
"All young people benefit from learning about how human rights were won and about the struggle against colonialism and racial injustice," she said.


The ToplistX control panel allows you to configure multiple administrator accounts so you can have several people working with the data at once. This document will provide an overview of the administrator account features of ToplistX
Account Types
There are two different types of administrator accounts: Editors and Administrators. Administrator level accounts will have access to all of the functions in the ToplistX control panel, and therefore should be reserved for those people that you completely trust. These users will be able to edit the software settings, templates, account data, category data, and use all of the other functions in the control panel.
The other type of account is an Editor account which will allow access to the account, category, and comment functions based on the privileges you select. So, for example, if you want to allow someone to access your ToplistX control panel so they can approve new accounts, but not edit the templates, you would create an Editor level account for them.
Searching Accounts
To view the currently configured administrator accounts so you can modify or delete them, access the Settings > Manage Administrators function from the control panel menu. This will display a page where you will be able to see all of the currently configured administrator accounts, and search them if necessary.
In the table that displays the administrator accounts, you will find several functions that you can run on a single administrator account. Each of those functions are described below.
| Click this icon to edit the administrator account. A window will appear where you will be able to edit all of the account settings. | |
| Click this icon to send an e-mail to this administrator account. A window will appear where you will enter the e-mail text. | |
| Click this icon to delete this administrator account. |
Adding an Account
To add a new administrator account access the Settings > Manage Administrators function from the control panel menu. Near the top of the page in the header bar that reads "Administrator Accounts" click on the icon. This will display a popup window where you will be able to enter the account information that you want to use. Each of the form fields are described below.
| Username | The username for this account that the user will login with |
| Password | The password for this account that the user will login with |
| Name | The name of this account holder |
| E-mail Address | The e-mail address of this account holder |
| Account Type | The account type, as described above |
| Categories | The privileges you want to assign to this editor account for category functions |
| Accounts | The privileges you want to assign to this editor account for account functions |
| Comments | The privileges you want to assign to this editor account for account comment functions |
|
Send e-mail when account scanner finishes Check this box if you want this administrator account to be e-mailed when the account scanner finishes running. The account scanner configuration must also be setup to send an e-mail. |
|
|
Send e-mail when an account is edited Check this box if you want this administrator account to be e-mailed when someone editis their account. |
Editing an Account
To edit an administrator account you will first need to locate it through the Account Searching interface. When you locate the account you want to edit, click on the icon to bring up the account editing interface. This interface is nearly identical to the administrator account creation interface, and has the same form fields with the same properties. You can make the changes that you want, and then press the Update Account button to save your changes.
Deleting an Account
To delete an administrator account you will first need to locate it through the Account Searching interface. When you locate the account you want to delete, click on the icon, which will ask you to confirm the deletion.
You can also delete several accounts at once by putting a check in the box next to the accounts you want to delete, then pressing the Delete button at the bottom of the page.


Election rigging or poor leadership: Bickering in Bengal BJP after TMC sweeps bypolls
The senior leadership in West Bengal BJP seems to be divided over the reasons for the party's loss in the bypolls.
From potshots at each other to mudslinging, bypolls in West Bengal are over and now its time for politicians to play who blames whom for the loss. The BJP, which registered a massive upswing from two Lok Sabha seats in 2014 to 18 seats in 2019 with around 40% vote share, the bypoll results on Thursday came as a shock. The party lost all three assembly constituencies Kaliaganj, Kharagpur and Karimpur in three parts of the state.
One of these seats, Kharagpur, was vacated by state party president Dilip Ghosh when he was elected as a member of the parliament from the same constituency. But not only did the BJP failed to defend it but lost by a margin of over 20,000 votes.
The senior leadership in West Bengal BJP seems to be divided over the reasons for the party's loss in the bypolls.
Booths were captured: Kailash Vijayvargiya
Senior leader and party's incharge for West Bengal Kailash Vijayvargiya blamed it the ruling TMC and alleged that the party rigged the elections using state machinery.
"If voting was conducted in a proper and unbiased manner then the BJP would have won but here in Bengal there was capturing of polling booths. The Election Commission had also said that there will be central forces on the ground but that did not happen at the booth level," Kailash Vijayvargiya alleged. He, however, added that the bypolls results were not a precursor to state assembly polls due in 2021.
"Mamata's true colour and face will come out after her mask is removed by the people itself," Vijayvargiya said.
EVMs and counting was rigged: Rahul Sinha
BJP national secretary Rahul Sinha further alleged that not just EVMs but elections were rigged.
"The election was supervised by the Election Commission of India. The people, who are working with the Election Commission, are the supporters of the TMC party," Rahul Sinha said.
He also claimed that counting of the vote was also rigged. "Leaving EVM tampering aside, I think that the other type of tampering might be in the vote counting. The state or government officers are the helping hands for the tampering of vote counting," he said.
Sinha claimed that there was no way the TMC could have won without cheating. "We will file an application with EC to seek investigation in tempering in EVMs and counting process," Sinha said.
Poor leadership, wrong causes reasons for loss: Chandra Bose
But there is a faction fo BJP leaders who are questioning the party's course of action in Bengal.
"Priority issues were not taken up. NRC is a non-issue in West Bengal at the present moment. Trinamool Congress took advantage of this and misguided the people on this NRC issue and created a paranoia situation to scare people of the BJP. We should have taken up issues like job creation, co-sector industry investments, farmer's welfare, looking into the failed law and order in the state to effectively counter the TMC. We do not have strong leadership in the state," BJP leader Chandra Bose said.
Party's vote share in assembly constituencies during different elections over the years:
| TMC Party | BJP Party | Left and Congress Party |
| Karimpur 2019 By-poll - 50.43 2019 Lok Sabha - 42.4 2016 Assembly 45.24 Kharagpur 2019 By-poll 47.66 2019 Lok Sabha -29.6 2016 Assembly 21.73 Kaliagunj 2019 By-poll 44.65 2019 Lok Sabha 27.3 2016 Assembly 30.87 |
Karimpur 2019 By-poll 38.75 2019 Lok Sabha 35.5 2016 Assembly 11.59 Kharagpur 2019 By-poll 34.02 2019 Lok Sabha 57.2 2016 Assembly 39.29 Kaliagunj 2019 By-poll 43.54 2019 Lok Sabha 52.2 2016 Assembly 12.7 |
Karimpur 2019 By-poll 9.09 (with alliance) 2019 Lok Sabha 19.2 (without alliance) 2016 Assembly 37.29 (with alliance) Kharagpur 2019 By-poll 14.8 (with alliance) 2019 Lok Sabha 10.1(without alliance) 2016 Assembly 35.25 (with alliance) Kaliagunj 2019 By-poll 8.65 (with alliance) 2019 Lok Sabha 16.5 (without alliance) 2016 Assembly 52.58 (with alliance) |
West Bengal has written BJP off: Mamata Banerjee
An elated Mamata Banerjee expressed joy on her party's victory in the bypolls and claimed that people of West Bengal had written off the BJP.
Giving credit to her fight against NRC, Mamata Banerjee said, "All the people, including people of several cast, creed and community, came together to cast their vote for us. This is an alliance of people. First of all people voiced that NRC will not be implemented in West Bengal and we don’t want to implement NRC in the whole country as well. I think that this victory is the verdict of people against NRC implementation."
The West Bengal CM asserted that the Centre will have to work with the state governments if it wants a resolution to issues and development. "They always think that either in my way or highway, this shouldn’t be like this. In a democracy, there is a national highway and a state highway. Both are important and we have to work together but if somebody thinks that they have the highway and we have no way, then nothing matters. We always agree that people matters. Even I want to appeal to the BJP leaders not to take all hasty decisions. You are also elected by the people, so work for the people," she said.


class Channel extends AbstractEntity
Properties
| $connection_details | ||
| $consumer_details | ||
| $idle_since | ||
| $transactional | ||
| $confirm | ||
| $consumer_count | ||
| $messages_unacknowledged | ||
| $messages_unconfirmed | ||
| $messages_uncommitted | ||
| $acks_uncommitted | ||
| $prefetch_count | ||
| $client_flow_blocked | ||
| $node | ||
| $name | ||
| $number | ||
| $user | ||
| $vhost |
Methods
| setAPIClient(APIClient $client) | from AbstractEntity | |
| toJson() | from AbstractEntity |


YBSlantedCollectionViewLayout
public class YBSlantedCollectionViewLayout: UICollectionViewLayout
YBSlantedCollectionViewLayout is a subclass of UICollectionViewLayout allowing the display of slanted content on UICollectionView.
By default, this UICollectionViewLayout has initialize a set of properties to work as designed.
-
The slanting delta.
By default, this property is set to
50
.Parameter
Parameter slantingDelta: The slantin deltaDeclaration
Swift
@IBInspectable public var slantingDelta: UInt = 50
Parameters
slantingDelta
The slantin delta
-
Reverse the slanting angle.
Set it to
true
to reverse the slanting angle. By default, this property is set tofalse
.Parameter
Parameter reverseSlantingAngle: The slanting angle reversing statusDeclaration
Swift
@IBInspectable public var reverseSlantingAngle: Bool = false
Parameters
reverseSlantingAngle
The slanting angle reversing status
-
Allows to disable the slanting for the first cell.
Set it to
false
to disable the slanting for the first cell. By default, this property is set totrue
.Parameter
Parameter firstCellSlantingEnabled: The first cell slanting statusDeclaration
Swift
@IBInspectable public var firstCellSlantingEnabled: Bool = true
Parameters
firstCellSlantingEnabled
The first cell slanting status
-
Allows to disable the slanting for the last cell.
Set it to
false
to disable the slanting for the last cell. By default, this property is set totrue
.Parameter
Parameter lastCellSlantingEnabled: The last cell slanting statusDeclaration
Swift
@IBInspectable public var lastCellSlantingEnabled: Bool = true
Parameters
lastCellSlantingEnabled
The last cell slanting status
-
The spacing to use between two items.
The spacing to use between two items. The default value of this property is 10.0.
Parameter
Parameter lineSpacing: The spacing to use between two itemsDeclaration
Swift
@IBInspectable public var lineSpacing: CGFloat = 10
Parameters
lineSpacing
The spacing to use between two items
-
The scroll direction of the grid.
The grid layout scrolls along one axis only, either horizontally or vertically. The default value of this property is
UICollectionViewScrollDirectionVertical
.Parameter
Parameter scrollDirection: The scroll direction of the gridDeclaration
Swift
public var scrollDirection: UICollectionViewScrollDirection = UICollectionViewScrollDirection.Vertical
Parameters
scrollDirection
The scroll direction of the grid
-
The item size options
Allows to set the item’s width/height depending on the scroll direction.
Declaration
Swift
public var itemSizeOptions: YBSlantedCollectionViewLayoutSizeOptions = YBSlantedCollectionViewLayoutSizeOptions()


3D 画廊房间
Demo 1
Demo 2
A Mermaid, 1900
Genre
literary painting
Technique
oil
Material
canvas
Dimensions
96.52 x 66.68 cm
Gallery
Royal Academy of Arts, UK
Hylas and the Nymphs, 1896
Genre
mythological painting
Technique
oil
Material
canvas
Dimensions
91 x 152 cm
Gallery
Manchester City Art Gallery, Manchester, UK
The Soul of the Rose, 1908
Genre
literary painting
Technique
oil
Material
canvas
Dimensions
61 x 91.4 cm
Gallery
Private Collection
Psyche entering Cupid's Garden, 1903
Genre
mythological painting
Technique
oil
Material
canvas
Dimensions
68.5 x 106.7 cm
Gallery
Harris Museum and Art Gallery, Preston, Lancashire, UK
Saint Cecilia, 1895
Genre
religious painting
Technique
oil
Material
canvas
Gallery
The Montreal Museum of Fine Arts, Montreal, Canada
The Beautiful Lady Without Pity, 1893
Genre
literary painting
Technique
oil
Material
canvas
Dimensions
81 x 112 cm
Gallery
Hessisches Landesmuseum, Darmstadt, Germany
The Naiad, 1893
Genre
mythological painting
Technique
oil
Material
canvas
Dimensions
127 x 66 cm
Gallery
Roy Miles Fine Paintings
Windflowers, 1902
Genre
literary painting
Technique
oil
Material
canvas
Dimensions
116.52 x 79.06 cm
Gallery
Private Collection
The Lady of Shalott, 1888
Technique
oil
Material
canvas
Gallery
Tate Britain, London, England, UK
The Awakening of Adonis, 1899
Genre
mythological painting
Technique
oil
Material
canvas
Dimensions
188 x 95.9 cm
Gallery
Private Collection


pokemonForm.pokemonName.$error = {{ vm.pokemonForm.pokemonName.$error | json }}
pokemonForm.pokemonWeight.$error = {{ vm.pokemonForm.pokemonWeight.$error | json }}