This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import decomposition | |
import numpy as np | |
pca = decomposition.PCA(n_components=2) | |
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) | |
x = pca.fit_transform(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
df = pd.DataFrame(data=[[3., 1., np.NaN], [np.NaN, 3., 2.], [4., 1., 3.]], index=[0, 1, 2], | |
columns=['apple', 'carrot', 'pear']) | |
def null_only_categorical_func(data): | |
""" | |
Take a series, and return values of 1. where the series is null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Pandas dataframe to txt file with comma delimiter test | |
df = pd.DataFrame(index = [0,1,2,3,4]) | |
df.loc[:, 'a'] = 'a' | |
df.loc[:, 'b'] = 2 | |
df.loc[:, 'c'] = ' ' | |
df.loc[:, 'd'] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'utilities/base.html' %} | |
{% block title %}{{ analysis_group.name }}{% endblock %} | |
{% block content %} | |
<div class="row justify-content-center"> | |
<div class="col-8"> | |
<div class="card border-primary mb-3"> | |
<div class="card-header"> | |
<h3>{{ analysis_group.name }}</h3> | |
<h4>{{ analysis_group.description }}</h4> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Blueprint, request | |
from ..helper_functions import cluster_analysis_function | |
analytics = Blueprint('analytics', __name__, template_folder='templates') | |
@analytics.route('/api/analytics/cluster_analysis', methods=['GET']) | |
def cluster_analysis_view(): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound | |
from voxco_survey_analysis.exceptions import InvalidUsage | |
from ..models import Analytic | |
def cluster_analysis_function(request): | |
""" | |
Perform a cluster analysis using the analysis group specified in the request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"specifications": | |
{ | |
"age": [ | |
{ | |
"min_age": "20", | |
"max_age": "25", | |
"sample_size": "20" | |
}, | |
{ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from dateutil import rrule as rr, relativedelta as rd | |
start_date = datetime.datetime(year=2017, month=1, day=1) | |
end_date = datetime.datetime(year=2018, month=1, day=1) | |
# Generate rule for valid dates under simple rule (Monthly from start until end) | |
valid_rule = rr.rrule(freq=rr.MONTHLY, dtstart=start_date, until=end_date) |
OlderNewer