repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
apache/spark
python/pyspark/pandas/tests/test_typedef.py
15
16852
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
MTgeophysics/mtpy
mtpy/modeling/modem/plot_response.py
1
123379
""" ================== ModEM ================== # Generate files for ModEM # revised by JP 2017 # revised by AK 2017 to bring across functionality from ak branch """ import numpy as np import os from matplotlib import pyplot as plt, gridspec as gridspec from matplotlib.ticker import MultipleLocator from matplotlib....
gpl-3.0
datapythonista/pandas
pandas/tests/arrays/floating/test_astype.py
6
3917
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_astype(): # with missing values arr = pd.array([0.1, 0.2, None], dtype="Float64") with pytest.raises(ValueError, match="cannot convert to 'int64'-dtype NumPy"): arr.astype("int64") with pytest.raises(...
bsd-3-clause
neurohackweek/avalanche
doc/sphinxext/docscrape_sphinx.py
154
7759
import re, inspect, textwrap, pydoc import sphinx from docscrape import NumpyDocString, FunctionDoc, ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config={}): self.use_plots = config.get('use_plots', False) NumpyDocString.__init__(self, docstring, config=config) ...
apache-2.0
johnmgregoire/JCAPdatavis
echem_stacked_tern_batch.py
1
6770
import matplotlib.cm as cm import numpy import pylab import h5py, operator, copy, os, csv, sys from echem_plate_fcns import * PyCodePath=os.path.split(os.path.split(os.path.realpath(__file__))[0])[0] sys.path.append(os.path.join(PyCodePath,'ternaryplot')) from myternaryutility import TernaryPlot from myquaternaryutili...
bsd-3-clause
besser82/shogun
examples/undocumented/python/graphical/preprocessor_kpca_graphical.py
11
1884
from numpy import * import matplotlib.pyplot as p import os, sys, inspect path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools')) if not path in sys.path: sys.path.insert(1, path) del path from generate_circle_data import circle_data cir=circle_data() number_of_points_for_circle1=42 number_of_p...
bsd-3-clause
gibiansky/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py
30
4727
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
Srisai85/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
202
3757
import scipy.sparse as sp import numpy as np import sys from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.testing import assert_raises_regex, assert_true from sklearn.utils.estimator_checks import check_estimator from sklearn.utils....
bsd-3-clause
ocefpaf/cartopy
lib/cartopy/examples/arrows.py
4
1195
""" Arrows ------ Plotting arrows. """ __tags__ = ['Vector data'] import matplotlib.pyplot as plt import numpy as np import cartopy.crs as ccrs import cartopy.feature as cfeature def sample_data(shape=(20, 30)): """ Return ``(x, y, u, v, crs)`` of some vector data computed mathematically. The returned...
lgpl-3.0
madan96/sympy
sympy/plotting/plot_implicit.py
83
14400
"""Implicit plotting module for SymPy The module implements a data series called ImplicitSeries which is used by ``Plot`` class to plot implicit plots for different backends. The module, by default, implements plotting using interval arithmetic. It switches to a fall back algorithm if the expression cannot be plotted ...
bsd-3-clause
jamesafoster/CompSkillsF16
summarize_Pandas_readtable.py
2
2096
#!/usr/bin/env python # demonstration of data exploration code for Comp Bio course, Fall 2016 # James A. Foster # WARNING: not completely error checked ''' Usage: summarize_Pandas.py inputFile where inputfile is a tab delimited summary of a Hiseq dataset, as in Homework 5 Questions to answer: - how many times do...
gpl-3.0
nathawkins/PHY451_FS_2017
Pulsed_NMR/NMR Python Tutorial/SpinlabCF.py
2
33740
# -*- coding: utf-8 -*- """ Spinlab Curve Fitting Library File: SpinlabCF.py Author: Steve Fromm Last Modified: 2017-09-05 This library provides an easy to use interface to perform non-linear function fitting to a provided data set. The underlying curve-fitting algorithm is from the scipy.optimize package....
gpl-3.0
jdavidrcamacho/Tests_GP
06 - Results/tests_lineardecay.py
1
16712
# -*- coding: utf-8 -*- import Gedi as gedi import numpy as np; #np.random.seed(13042017) import matplotlib.pylab as pl; pl.close("all") import astropy.table as Table import sys ##### Spots data preparation ################################################## print print "**************************************...
mit
Astroua/TurbuStat
turbustat/statistics/wavelets/wavelet_transform.py
2
25354
# Licensed under an MIT open source license - see LICENSE from __future__ import print_function, absolute_import, division import numpy as np import warnings import astropy.units as u import statsmodels.api as sm from warnings import warn from astropy.utils.console import ProgressBar from astropy.convolution import c...
mit
sangwook236/general-development-and-testing
sw_dev/python/rnd/test/machine_learning/sklearn/sklearn_logistic_regression.py
2
1182
#!/usr/bin/env python # -*- coding: UTF-8 -*- # REF [site] >> # http://scikit-learn.org/stable/modules/linear_model.html # http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html from sklearn import linear_model from sklearn import datasets import numpy as np def main(): #X = n...
gpl-2.0
dreuven/SampleSparse
SampleSparse/scripts/sparsecoding/PersonalPlotting.py
3
9713
import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm class PPlotting: root_directory = None def __init__(self, directory): # try: # str(directory) # except: # print("Cannot convert input to string. Put in a name!") self.root_directory = st...
gpl-3.0
cameronlai/ml-class-python
skeletons/ex8/ex8_utility.py
2
3960
import numpy as np import matplotlib.pyplot as plt from ex8_cofi import * def multivariateGaussian(X, mu, Sigma2): k = mu.size if Sigma2.shape[0] == 1 or Sigma2.shape[1] == 1: dim = np.max(Sigma2.shape) diag = Sigma2 Sigma2 = np.zeros((dim, dim)) np.fill_diagonal(Sigma2, di...
mit
AIML/scikit-learn
sklearn/feature_selection/__init__.py
244
1088
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
bsd-3-clause
subutai/htmresearch
projects/sp_paper/plot_traces_with_errorbars.py
10
5345
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
USF-COT/trdi_adcp_readers
trdi_adcp_readers/readers.py
1
28613
import numpy as np import dask.array as darr from dask import compute, delayed from dask.bag import from_delayed, from_sequence from pandas import Timedelta from xarray import Variable, IndexVariable, DataArray, Dataset from trdi_adcp_readers.pd0.pd0_parser_sentinelV import (ChecksumError, ...
mit
NelisVerhoef/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
176
2169
from nose.tools import assert_equal import numpy as np from sklearn.preprocessing import FunctionTransformer def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X): def _func(X, *args, **kwargs): args_store.append(X) args_store.extend(args) kwargs_store.update(kwargs) ...
bsd-3-clause
RuthAngus/LSST-max
code/soft/regions.py
1
5812
import numpy as np import matplotlib.pyplot as plt import time def regions(seed=0, randspots, activityrate=1, cyclelength=1, cycleoverlap=0, maxlat=70, minlat=0, tsim=1000, tstart=0, dir="."): """ inputs activityrate - number of bipoles (1= solar) cyclelength - length of cycle in years ...
mit
LukeC92/iris
lib/iris/tests/unit/plot/test_scatter.py
12
2596
# (C) British Crown Copyright 2014 - 2016, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
abitofalchemy/hrg_nets
scale_sampled_graph.py
1
6935
__authors__ = 'saguinag,tweninge,dchiang' __contact__ = '{authors}@nd.edu' __version__ = "0.1.0" # scale_sampled_graph.py # VersionLog: # 0.1.0 Initial state; import math import re import networkx as nx import pandas as pd import david as pcfg import graph_sampler as gs # import net_metrics as metrics import pro...
gpl-3.0
IssamLaradji/scikit-learn
sklearn/feature_extraction/image.py
32
17167
""" The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to extract features from images. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Olivier Grisel # Vlad Niculae # License: BSD 3 clause fro...
bsd-3-clause
hansomesong/TracesAnalyzer
Plot/Plot_variable_time/Plot_variable_time_Case4-1_scatter.py
1
1899
__author__ = 'yueli' import numpy as np import matplotlib.pyplot as plt from config.config import * # Import the targeted raw CSV file rawCSV_file = os.path.join(PLANET_CSV_DIR, 'liege', 'planetlab1-EID-153.16.47.16-MR-149.20.48.61.log.csv') # In this situation(this file), there is only RoundNormal and NoMapReply, no...
gpl-2.0
openelections/openelections-data-ca
src/parse_general_2014.py
2
3793
import pandas as pd import re from swdb.util import COUNTIES url_prefix = 'http://elections.cdn.sos.ca.gov/sov/2014-general/xls/' state_level_files = [ ('19-governor.xls', 'Governor'), ('22-lieutenant-governor.xls', 'Lieutenant Governor'), ('25-secretary-of-state.xls', 'Secretary of State'), ('28-cont...
mit
jdorvi/MonteCarlos_SLC
calculate_gap.py
1
1836
# -*- coding: utf-8 -*- """ Created on Mon Oct 17 17:57:40 2016 @author: jdorvinen """ import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt # <codecell> # Model data fit: alpha=1.498, beta=-0.348, gamma=1.275 # Callaghan et al. used: alpha=21.46, beta=1.08, gamma=1.07 a = 12*1.49...
mit
henridwyer/scikit-learn
examples/feature_selection/plot_rfe_with_cross_validation.py
226
1384
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) import matplotlib.p...
bsd-3-clause
yhat/ggplot
tests/test_bar.py
1
2275
from ggplot import * import pandas as pd import numpy as np import sys df = pd.DataFrame({ 'x': ['a', 'b', 'c', 'b', 'b', 'b', 'a', 'c', 'b', 'c', 'a'], 'wt': [2, 3, 4, 10, 1, 1, 2, 10, 10, 4, 1], 'thingy': ['hi','bye', 'hi', 'bye', 'bye', 'bye', 'bye', 'hi', 'bye', 'bye', 'bye'], 'filler': ['limegreen...
bsd-2-clause
esdalmaijer/CancellationTools
setup.py
1
6601
# IMPORTS # import every package we use, this prevents some errors import matplotlib, numpy, pygame # import everything we need to package stuff from distutils.core import setup import distutils.sysconfig as sysconfig from py2exe.build_exe import py2exe # import modules to to some file magic import compileall import os...
gpl-3.0
davidgbe/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
276
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
abhisg/scikit-learn
sklearn/tests/test_common.py
4
8719
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD 3 clause from __future__ import print_function import os import warnings import sys import pkgutil from sklearn.externals.six import PY3 fr...
bsd-3-clause
gkunter/coquery
test/test_functionlist.py
1
6558
# -*- coding: utf-8 -*- """ This module tests the functionlist module. Run it like so: coquery$ python -m test.test_functionlist """ from __future__ import unicode_literals import warnings import pandas as pd from argparse import Namespace import logging from coquery.functionlist import FunctionList from coquery....
gpl-3.0
michelp/pywt
demo/dwt_swt_show_coeffs.py
6
2469
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import pywt import pywt.data ecg = pywt.data.ecg() data1 = np.concatenate((np.arange(1, 400), np.arange(398, 600), np.arange(601, 1024))) x = np.linspace(0.082, 2.128, nu...
mit
kubeflow/pipelines
components/PyTorch/_samples/Train_fully-connected_network.pipeline.py
1
3627
from kfp import components chicago_taxi_dataset_op = components.load_component_from_url('https://raw.githubusercontent.com/kubeflow/pipelines/e3337b8bdcd63636934954e592d4b32c95b49129/components/datasets/Chicago%20Taxi/component.yaml') pandas_transform_csv_op = components.load_component_from_url('https://raw.githubuse...
apache-2.0
dustinbcox/biodatalogger
biodata_grapher.py
1
1356
#!/usr/bin/python2.7 """ Biodata_grapher 2015-08-30 """ import glob import csv import os import matplotlib.pyplot as plt import matplotlib from datetime import datetime import traceback for filename in glob.glob('*_biodatalogger_readings.csv'): filename_png = filename.replace('.csv', '.png') if os.path.exist...
gpl-2.0
robintw/scikit-image
doc/examples/plot_polygon.py
17
2597
""" ================================== Approximate and subdivide polygons ================================== This example shows how to approximate (Douglas-Peucker algorithm) and subdivide (B-Splines) polygonal chains. """ from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from...
bsd-3-clause
szhem/spark
examples/src/main/python/sql/arrow.py
13
3997
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
meduz/scikit-learn
sklearn/utils/tests/test_fixes.py
28
3156
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import pickle import numpy as np import math from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true ...
bsd-3-clause
jaeilepp/eggie
mne/epochs.py
1
82772
"""Tools for working with epoched data""" # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Matti Hamalainen <msh@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Denis Engemann <denis.engemann@gmail.com> # Mainak Jas <mainak@neuro...
bsd-2-clause
glennhickey/hgvm-graph-bakeoff-evaluations
scripts/barchart.py
6
11581
#!/usr/bin/env python2.7 """ barchart: plot a bar chart of a TSV file of numbers. The file should be a column of int or text labels and a column of floats, with one value per label. Re-uses sample code and documentation from <http://users.soe.ucsc.edu/~karplus/bme205/f12/Scaffold.html> """ import argparse, sys, os, ...
mit
timqian/sms-tools
lectures/3-Fourier-properties/plots-code/convolution-2.py
24
1259
import matplotlib.pyplot as plt import numpy as np from scipy.fftpack import fft, fftshift plt.figure(1, figsize=(9.5, 7)) M = 64 N = 64 x1 = np.hanning(M) x2 = np.cos(2*np.pi*2/M*np.arange(M)) y1 = x1*x2 mY1 = 20 * np.log10(np.abs(fftshift(fft(y1, N)))) plt.subplot(3,2,1) plt.title('x1 (hanning)') plt.plot(np.arange...
agpl-3.0
rcharp/toyota-flask
venv/lib/python2.7/site-packages/numpy/linalg/linalg.py
35
67345
"""Lite version of scipy.linalg. Notes ----- This module is a lite version of the linalg.py module in SciPy which contains high-level Python interface to the LAPACK library. The lite version only accesses the following LAPACK functions: dgesv, zgesv, dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr...
apache-2.0
CCI-Tools/ect-core
cate/webapi/mpl.py
2
12044
# The MIT License (MIT) # Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including wi...
mit
gotomypc/scikit-learn
sklearn/utils/tests/test_utils.py
215
8100
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from itertools import chain from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal, SkipTest, ...
bsd-3-clause
fyffyt/scikit-learn
benchmarks/bench_isotonic.py
268
3046
""" Benchmarks of isotonic regression performance. We generate a synthetic dataset of size 10^n, for n in [min, max], and examine the time taken to run isotonic regression over the dataset. The timings are then output to stdout, or visualized on a log-log scale with matplotlib. This alows the scaling of the algorith...
bsd-3-clause
nhejazi/scikit-learn
sklearn/svm/tests/test_sparse.py
63
13366
import numpy as np from scipy import sparse from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from sklearn import datasets, svm, linear_model, base from sklearn.datasets import make_classification, load_digits, make_blobs from sklearn.svm.tests import te...
bsd-3-clause
enigmampc/catalyst
catalyst/assets/synthetic.py
1
8861
from itertools import product from string import ascii_uppercase import pandas as pd from pandas.tseries.offsets import MonthBegin from six import iteritems from .futures import CME_CODE_TO_MONTH def make_rotating_equity_info(num_assets, first_start, frequ...
apache-2.0
trichter/sito
bin/rf/rf_timevari2_old.py
1
13003
#!/usr/bin/env python # -*- coding: utf-8 -*- # by TR from IPython import embed from obspy.core import UTCDateTime as UTC from operator import neg from sito import read from sito.stream import Stream from termcolor import colored import cPickle import collections import matplotlib as mpl import numpy as np import pylab...
mit
adiIspas/Machine-Learning_A-Z
Machine Learning A-Z/Part 3 - Classification/Section 19 - Decision Tree Classification/decision_tree_classification.py
5
2725
# Decision Tree Classification # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Social_Network_Ads.csv') X = dataset.iloc[:, [2, 3]].values y = dataset.iloc[:, 4].values # Splitting the dataset into the Training set and Te...
mit
rajat1994/scikit-learn
examples/text/document_clustering.py
230
8356
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
lanfker/tdma_imac
src/flow-monitor/examples/wifi-olsr-flowmon.py
27
7354
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
nicproulx/mne-python
mne/preprocessing/tests/test_ica.py
2
31454
from __future__ import print_function # Author: Denis Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import os import os.path as op import warnings from nose.tools import (assert_true, assert_raises, assert_equal, assert_false, ...
bsd-3-clause
luo66/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
341
2620
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.cluster.affinity_propagation_ import AffinityPropagation from sklearn.cluster.affinity_propagatio...
bsd-3-clause
paula-tataru/SpikeyTree
src/optimize.py
1
8262
# This file is part of SpikeyTree. # Copyright (C) 2015 Paula Tataru # SpikeyTree is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # T...
gpl-3.0
juanshishido/okcupid
utils/clean_up.py
1
1270
import re import numpy as np import pandas as pd from bs4 import BeautifulSoup def clean_up(input_df, col_names, min_words=5): ''' Input : data frame and list of columns to clean up Returns: cleaned data frame (overwrites those columns) Drops user if any essay has < min_words number of words (default...
mit
hall-lab/svtools
svtools/sv_classifier.py
1
25139
#!/usr/bin/env python import argparse, sys, copy, gzip, math import numpy as np import pandas as pd from scipy import stats from collections import namedtuple import statsmodels.formula.api as smf from operator import itemgetter import warnings from svtools.vcf.file import Vcf from svtools.vcf.variant import Variant i...
mit
molliewebb/aston
aston/qtgui/PlotSpec.py
3
5186
import time import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from matplotlib.backends.backend_qt4 import NavigationToolbar2QT #from matplotlib.ticker import AutoMinorLocator #from aston.spectra import Spectrum class SpecPlotter(object): def _...
gpl-3.0
Mushirahmed/gnuradio
gr-utils/src/python/plot_psd_base.py
75
12725
#!/usr/bin/env python # # Copyright 2007,2008,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at ...
gpl-3.0
amozie/amozie
testzie/table_test.py
1
3048
import numpy as np import pandas as pd lt = 'f:/lt/' region = pd.read_csv(lt + 'region.csv',sep='\t', index_col=0) # 排除内蒙古和西藏 # prvs = ['北京', '天津', '河北', '山东', '辽宁', '江苏', '上海', '浙江', '福建', '广东', '海南', '吉林', # '黑龙江', '山西', '河南', '安徽', '江西', '湖北', '湖南', '广西', '重庆', '四川', '贵州', '云南', # '陕西', '甘肃', '青海', '...
apache-2.0
taknevski/tensorflow-xsmm
tensorflow/python/estimator/inputs/pandas_io.py
86
4503
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
femtotrader/ig-markets-stream-api-python-library
tests/test_historical_prices_flat.py
2
9617
from trading_ig.rest import IGService import responses import json import pandas as pd import datetime import pytest """ unit tests for historical prices methods with flat output formatting """ class TestHistoricalPricesFlat: @responses.activate def test_historical_prices_v3_defaults_happy(self): #...
bsd-3-clause
poryfly/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
bsipocz/statsmodels
statsmodels/sandbox/rls.py
33
5179
"""Restricted least squares from pandas License: Simplified BSD """ from __future__ import print_function import numpy as np from statsmodels.regression.linear_model import WLS, GLS, RegressionResults class RLS(GLS): """ Restricted general least squares model that handles linear constraints Parameters ...
bsd-3-clause
leesavide/pythonista-docs
Documentation/matplotlib/pyplots/text_layout.py
6
2085
import matplotlib.pyplot as plt import matplotlib.patches as patches # build a rectangle in axes coords left, width = .25, .5 bottom, height = .25, .5 right = left + width top = bottom + height fig = plt.figure() ax = fig.add_axes([0,0,1,1]) # axes coordinates are 0,0 is bottom left and 1,1 is upper right p = patche...
apache-2.0
galfaroi/trading-with-python
cookbook/workingWithDatesAndTime.py
77
1551
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 17:45:02 2011 @author: jev """ import time import datetime as dt from pandas import * from pandas.core import datetools # basic functions print 'Epoch start: %s' % time.asctime(time.gmtime(0)) print 'Seconds from epoch: %.2f' % time.time() t...
bsd-3-clause
ktaneishi/deepchem
examples/binding_pockets/binding_pocket_datasets.py
9
6311
""" PDBBind binding pocket dataset loader. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import numpy as np import pandas as pd import shutil import time import re from rdkit import Chem import deepchem as dc def compute_binding_pocket_fea...
mit
wanggang3333/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
harisbal/pandas
pandas/tests/scalar/interval/test_ops.py
1
2370
"""Tests for Interval-Interval operations, such as overlaps, contains, etc.""" import pytest from pandas import Interval, Timedelta, Timestamp import pandas.util.testing as tm @pytest.fixture(params=[ (Timedelta('0 days'), Timedelta('1 day')), (Timestamp('2018-01-01'), Timedelta('1 day')), (0, 1)], ids=l...
bsd-3-clause
moutai/scikit-learn
examples/cluster/plot_face_compress.py
71
2479
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Vector Quantization Example ========================================================= Face, a 1024 x 768 size image of a raccoon face, is used here to illustrate how `k`-means is used for vector quantization. """ ...
bsd-3-clause
pianomania/scikit-learn
examples/mixture/plot_gmm_selection.py
95
3310
""" ================================ Gaussian Mixture Model Selection ================================ This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in the ...
bsd-3-clause
chenyyx/scikit-learn-doc-zh
examples/zh/linear_model/plot_sgd_loss_functions.py
86
1234
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
gpl-3.0
ankanch/tieba-zhuaqu
DSV-user-application-plugin-dev-kit/default-plugins/tiebaX/lib/graphicsData.py
1
3707
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties import numpy import os font_set = FontProperties(fname=r"c:\\windows\\fonts\\simsun.ttc", size=15) #重要全局变量 PATH_SUFFIX = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) PATH_SU...
gpl-3.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/legend_handler.py
6
22594
""" This module defines default legend handlers. It is strongly encouraged to have read the :ref:`legend guide <plotting-guide-legend>` before this documentation. Legend handlers are expected to be a callable object with a following signature. :: legend_handler(legend, orig_handle, fontsize, handlebox) Where *l...
gpl-3.0
Lawrence-Liu/scikit-learn
examples/svm/plot_svm_regression.py
249
1451
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
xiaoxiamii/scikit-learn
sklearn/tests/test_discriminant_analysis.py
5
11057
try: # Python 2 compat reload except NameError: # Regular Python 3+ import from importlib import reload import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.t...
bsd-3-clause
benjello/openfisca-france-indirect-taxation
openfisca_france_indirect_taxation/non_working_tests/tests_aids_categ.py
4
4880
# -*- coding: utf-8 -*- """ Created on Thu Jul 09 18:41:37 2015 @author: thomas.douenne """ # To do : change this test to fit with energy instead of categ import pandas as pd from openfisca_france_indirect_taxation.almost_ideal_demand_system.aids_dataframe_builder_categ import \ aggregates_data_frame, df, produ...
agpl-3.0
gena/qgis-earthengine-plugin
contrib/palettes.py
1
45630
# Copyright (c) 2018 Gennadii Donchyts. All rights reserved. # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # Contributors: # * 2018-08-01: Fedor Baart (f.baart@gmail.com) - added cmocean # * 2019-01-18: Justin Braaten (jstnbraaten@gmail.com) - ...
mit
robin-lai/scikit-learn
sklearn/neural_network/tests/test_rbm.py
225
6278
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
MVilstrup/visualize
decision_regions.py
1
3766
# This code is a modified version of Sebastian Raschka's file of same name # Original code can be found here: # https://github.com/rasbt/mlxtend/blob/master/mlxtend/evaluate/decision_regions.py from itertools import cycle import matplotlib import matplotlib.pyplot as plt from matplotlib import cm import numpy as np ...
mit
YzPaul3/h2o-3
py2/h2o_gbm.py
30
16328
import re, random, math import h2o_args import h2o_nodes import h2o_cmd from h2o_test import verboseprint, dump_json, check_sandbox_for_errors def plotLists(xList, xLabel=None, eListTitle=None, eList=None, eLabel=None, fListTitle=None, fList=None, fLabel=None, server=False): if h2o_args.python_username!='kevin': ...
apache-2.0
barak/autograd
examples/fluidsim/fluidsim.py
1
4629
from __future__ import absolute_import from __future__ import print_function import autograd.numpy as np from autograd import value_and_grad from scipy.optimize import minimize from scipy.misc import imread import matplotlib import matplotlib.pyplot as plt import os from builtins import range # Fluid simulation code...
mit
b-cuts/airflow
airflow/hooks/base_hook.py
20
1812
from builtins import object import logging import os import random from airflow import settings from airflow.models import Connection from airflow.utils import AirflowException CONN_ENV_PREFIX = 'AIRFLOW_CONN_' class BaseHook(object): """ Abstract base class for hooks, hooks are meant as an interface to ...
apache-2.0
dhuppenkothen/stingray
stingray/tests/test_io.py
1
6788
from __future__ import (absolute_import, unicode_literals, division, print_function) import numpy as np import os from ..io import read, write import warnings curdir = os.path.abspath(os.path.dirname(__file__)) datadir = os.path.join(curdir, 'data') class TestIO(object): """Real unit te...
mit
michaelerule/neurotools
stats/matzner_bar-gad_PLoS_2015.py
1
3690
#!/usr/bin/python # -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import with_statement from __future__ import division from __future__ import nested_scopes from __future__ import generators from __future__ import unicode_literals from __future__ import print_function from neurotools.syst...
gpl-3.0
florentchandelier/zipline
zipline/__main__.py
1
12454
import errno import os from importlib import import_module from functools import wraps import click import logbook import pandas as pd from six import text_type import pkgutil from zipline.data import bundles as bundles_module from zipline.utils.cli import Date, Timestamp from zipline.utils.run_algo import _run, lo...
apache-2.0
ODM2/ODMToolsPython
odmtools/lib/ObjectListView/virtualObjectListviewExample.py
1
16457
import wx import wx.xrc import sys sys.path.insert(0, "/home/jmeline/Projects/ODMToolsPython/odmtools/lib") from ObjectListView import VirtualObjectListView as OLV, ColumnDefn import pandas as pd import numpy as np # Simple minded model objects for our examples import datetime class Track(object): """ Simpl...
bsd-3-clause
renewables-ninja/gsee
gsee/climatedata_interface/pre_gsee_processing.py
1
14293
import math as m import pandas as pd import warnings import numpy as np import xarray as xr import scipy.stats as st from calendar import monthrange from gsee.climatedata_interface import kt_h_sinusfunc as cyth from gsee.climatedata_interface.progress import progress_bar from gsee import trigon, brl_model from gsee imp...
bsd-3-clause
whn09/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py
111
7865
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
tkralphs/Dip
Dip/scripts/plot_bounds.py
2
2055
import matplotlib.pyplot as plt plt.rc('axes', grid=True) plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5) #textsize = 9 #left, width = 0.1, 0.8 #rect1 = [left, 0.7, width, 0.2] #rect2 = [left, 0.3, width, 0.4] #rect3 = [left, 0.1, width, 0.2] fig = plt.figure(facecolor='white') axescolor = ...
epl-1.0
gregreen/legacypipe
py/legacypipe/runbrick.py
1
124870
''' Main "pipeline" script for the Dark Energy Camera Legacy Survey (DECaLS) data reductions. For calling from other scripts, see: - :py:func:`run_brick` Or for much more fine-grained control, see the individual stages: - :py:func:`stage_tims` - :py:func:`stage_image_coadds` - :py:func:`stage_srcs` - :py:func:`stag...
gpl-2.0
Lawrence-Liu/scikit-learn
doc/sphinxext/gen_rst.py
142
40026
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
trungnt13/scikit-learn
sklearn/manifold/tests/test_isomap.py
226
3941
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from sklearn import datasets from sklearn import manifold from sklearn import neighbors from sklearn import pipeline from sklearn import preprocessing from sklearn.utils.testing import assert_less ...
bsd-3-clause
ecell/epdp
samples/rebind/plot.py
3
3514
#!/usr/bin/env/python # varying kf # python plot.py 05/data/rebind_1_0.1_ALL_t.dat 05/data/rebind_1_1_ALL_t.dat 05/data/rebind_1_10_ALL_t.dat # 0.01 didn't run correctly? # 05/data/rebind_1_0.01_ALL_t.dat # varying D # python plot.py 07/data/rebind_0.1_10_0_ALL_t.dat 07/data/rebind_1_10_0_ALL_t.dat 07/data/rebind...
gpl-2.0
deeplook/bokeh
examples/compat/seaborn/violin.py
34
1153
import seaborn as sns from bokeh import mpl from bokeh.plotting import output_file, show tips = sns.load_dataset("tips") sns.set_style("whitegrid") # ax = sns.violinplot(x="size", y="tip", data=tips.sort("size")) # ax = sns.violinplot(x="size", y="tip", data=tips, # order=np.arange(1, 7), palett...
bsd-3-clause
yashu-seth/networkx
examples/graph/napoleon_russian_campaign.py
44
3216
#!/usr/bin/env python """ Minard's data from Napoleon's 1812-1813 Russian Campaign. http://www.math.yorku.ca/SCS/Gallery/minard/minard.txt """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" # Copyright (C) 2006 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <sw...
bsd-3-clause
btabibian/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
83
5888
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
detrout/debian-statsmodels
statsmodels/examples/ex_regressionplots.py
34
4457
# -*- coding: utf-8 -*- """Examples for Regression Plots Author: Josef Perktold """ from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std import statsmodels.graphics.regressionplots ...
bsd-3-clause
pvalienteverde/ElCuadernillo
ElCuadernillo/20160725_SistemasDeRecomendacionContentBased/Scripts/ContendBased.py
1
2180
import pandas as pd from sklearn.metrics.pairwise import pairwise_distances from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.neighbors import NearestNeighbors import numpy as np from nltk.corpus import stopwords class ContentBased(object): """ Modelo de recomendación de articulos basad...
mit