Skip to content

Instantly share code, notes, and snippets.

View CarlKCarlK's full-sized avatar

Carl Kadie CarlKCarlK

View GitHub Profile
@CarlKCarlK
CarlKCarlK / example1.ipynb
Last active September 27, 2020 00:03
Example 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
@CarlKCarlK
CarlKCarlK / example2.ipynb
Created September 27, 2020 00:25
Example 2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CarlKCarlK
CarlKCarlK / example3.ipynb
Created September 27, 2020 00:42
Example 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CarlKCarlK
CarlKCarlK / example4.ipynb
Created September 27, 2020 00:46
Example 4
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CarlKCarlK
CarlKCarlK / example5.ipynb
Created September 27, 2020 00:49
Example 5
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CarlKCarlK
CarlKCarlK / example1.py
Created September 27, 2020 02:03
Example 1
import pandas as pd
df = pd.DataFrame([['a',2,True],
['b',3,False],
['c',1,False]],columns=['alpha','num','class'])
df.set_index(['alpha'],inplace=True)
df
@CarlKCarlK
CarlKCarlK / example1b.py
Created September 27, 2020 02:07
Example 1b
df.loc['b'] # returns row 'b' as a series
import pandas as pd
df1 = pd.DataFrame([['a',2,True],
['b',3,False],
['c',1,False]],
columns=['alpha','num','class'])
df1.set_index(['alpha'],inplace=True)
df1
df1.loc[['b']] # returns row 'b' as a dataframe