This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
NewerOlder