prompt stringlengths 130 399k | completion stringlengths 7 146 | api stringlengths 10 61 |
|---|---|---|
import deimos
import numpy as np
from monkey.core.collections import Collections
import pytest
from tests import localfile
@pytest.fixture()
def ms1():
return deimos.load_hkf(localfile('resources/example_data.h5'),
key='ms1')
@pytest.mark.parametrize('x,expected',
... | Collections(expected) | pandas.core.series.Series |
import monkey as mk
from math import sqrt
def cumulative_waiting_time(knowledgeframe):
'''
Compute the cumulative waiting time on the given knowledgeframe
:knowledgeframe: a KnowledgeFrame that contains a "starting_time" and a
"waiting_time" column.
'''
# Avoid side effect
kf = mk.Kno... | mk.KnowledgeFrame.clone(knowledgeframe) | pandas.DataFrame.copy |
# pylint: disable-msg=E1101
# pylint: disable-msg=E1103
# pylint: disable-msg=W0232
import numpy as np
from monkey.lib.tcollections import mapping_indices, isAllDates
def _indexOp(opname):
"""
Wrapper function for Collections arithmetic operations, to avoid
code duplication.
"""
def wrapper(self, ... | mapping_indices(self) | pandas.lib.tseries.map_indices |
"""
Functions for preparing various inputs passed to the KnowledgeFrame or Collections
constructors before passing them to a BlockManager.
"""
from collections import abc
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple, Union
import numpy as np
import numpy.ma as ma
from monkey._libs impo... | Collections(data, index=columns, dtype=object) | pandas.core.series.Series |
"""
Additional tests for MonkeyArray that aren't covered by
the interface tests.
"""
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.arrays import MonkeyArray
from monkey.core.arrays.numpy_ import MonkeyDtype
@pytest.fixture(
params=[
np.array(["a", "b"], dty... | MonkeyArray(arr) | pandas.arrays.PandasArray |
import numpy as np
import sys
import os
import monkey as mk
import flammkuchen as fl
from scipy.stats import zscore
from scipy.signal import detrend
from numba import jit
from ec_code.phy_tools.utilities.spikes_detection import *
import numpy as np
import monkey as mk
from scipy import signal
from scipy.signal impor... | mk.sweep.getting_max() | pandas.sweep.max |
def ConvMAT2CSV(rootDir, codeDir):
"""
Written by <NAME> and <NAME> to work with macOS/Unix-based systems
Purpose: Extract data from .mat files and formating into KnowledgeFrames
Export as csv file
Inputs: PythonData.mat files, animalNotes_baselines.mat file
Outputs: .csv ... | mk.KnowledgeFrame.average(baseData.iloc[startTime:endTime, e]) | pandas.DataFrame.mean |
# -*- coding: utf-8 -*-
"""
German bank holiday.
"""
try:
from monkey import Timedelta
from monkey.tcollections.offsets import Easter, Day, Week
from monkey.tcollections.holiday import EasterMonday, GoodFriday, \
Holiday, AbstractHolidayCalengthdar
except ImportError:
print('Monkey could not ... | Easter.employ(*args, **kwargs) | pandas.tseries.offsets.Easter.apply |
from __future__ import print_function
import unittest
import sqlite3
import csv
import os
import nose
import numpy as np
from monkey import KnowledgeFrame, Collections
from monkey.compat import range, lrange, iteritems
#from monkey.core.datetools import formating as date_formating
import monkey.io.sql as sql
import ... | sql.MonkeySQLAlchemy(self.conn) | pandas.io.sql.PandasSQLAlchemy |
import os
import monkey as mk
from gym_brt.data.config.configuration import FREQUENCY
from matplotlib import pyplot as plt
def set_new_model_id(path):
model_id = 0
for (_, dirs, files) in os.walk(path):
for dir in dirs:
try:
if int(dir[:3]) >= model_id:
... | mk.KnowledgeFrame.fillnone(result_log, value=0, inplace=True) | pandas.DataFrame.fillna |
from collections.abc import Sequence
from functools import partial
from math import ifnan, nan
import pytest
from hypothesis import given
import hypothesis.strategies as st
from hypothesis.extra.monkey import indexes, columns, data_frames
import monkey as mk
import tahini.core.base
import tahini.testing
names_index_... | mk.Timedelta.getting_min.to_pytimedelta() | pandas.Timedelta.min.to_pytimedelta |
#!/usr/bin/env python
import monkey as mk
from monkey.util.decorators import Appender
import monkey.compat as compat
from monkey_ml.core.base import _BaseEstimator
from monkey_ml.core.generic import ModelPredictor, _shared_docs
from monkey_ml.core.frame import ModelFrame
from monkey_ml.core.collections import ModelCo... | mk.core.grouper.KnowledgeFrameGroupBy.transform(self, func, *args, **kwargs) | pandas.core.groupby.DataFrameGroupBy.transform |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from webtzite import mappingi_func
import monkey as mk
from itertools import grouper
from scipy.optimize import brentq
from webtzite.connector import ConnectorBase
from mpcontribs.rest.views import Connector
from mpcontribs.users.redo... | mk.np.adding(resiso, resiso_theo) | pandas.np.append |
import statfile as sf
import pickle
import monkey as mk
import os
import platform
def formatingData(folder, fileName):
"""
getting the relevant data from the file with the corresponding filengthame, then make a dictionary out of it
Parameters:
- folder: the folder where the file is locat... | mk.knowledgeframe(default) | pandas.dataframe |
#!/usr/bin/env python
# coding: utf-8
##################################################################
#
# # Created by: <NAME>
#
# # On date 20-03-2019
#
# # Game Of Thrones Analisys
#
#
#
#################################################################
"""
Chtotal_allengthge
There are approximatel... | mk.np.average(rf_score) | pandas.np.mean |
from __future__ import print_function
import unittest
import sqlite3
import csv
import os
import nose
import numpy as np
from monkey import KnowledgeFrame, Collections
from monkey.compat import range, lrange, iteritems
#from monkey.core.datetools import formating as date_formating
import monkey.io.sql as sql
import ... | sql.MonkeySQLLegacy(self.conn, 'sqlite') | pandas.io.sql.PandasSQLLegacy |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(arr, [arr[0]]) | pandas.core.algorithms.isin |
import argparse
import os
import string
import json
from pathlib import Path
import monkey as mk
import matplotlib.pyplot as plt # plotting
import numpy as np # dense matrices
from scipy.sparse import csr_matrix # sparse matrices
class PersonalData:
def __... | mk.header_num() | pandas.head |
# PyLS-PM Library
# Author: <NAME>
# Creation: November 2016
# Description: Library based on <NAME>'s simplePLS,
# <NAME>'s plspm and <NAME>'s matrixpls made in R
import monkey as mk
import numpy as np
import scipy as sp
import scipy.stats
from .qpLRlib4 import otimiza, plotaIC
import scipy.linalg
from col... | mk.KnowledgeFrame.getting_max(self.data, axis=0) | pandas.DataFrame.max |
import monkey as mk
import requests
import ratelimit
from ratelimit import limits
from ratelimit import sleep_and_retry
def id_to_name(x):
"""
Converts from LittleSis ID number to name.
Parameters
----------
x : LittleSis ID number
Example
-------
>>> id_to_name(96583)
'<... | mk.KnowledgeFrame.convert_dict(data) | pandas.DataFrame.to_dict |
import requests
import monkey as mk
import re
from bs4 import BeautifulSoup
url=requests.getting("http://www.worldometers.info/world-population/india-population/")
t=url.text
so=BeautifulSoup(t,'html.parser')
total_all_t=so.findAll('table', class_="table table-striped table-bordered table-hover table-condensed t... | mk.Collections.convert_list(bv[0:7][10]) | pandas.Series.tolist |
import requests
import monkey as mk
import re
from bs4 import BeautifulSoup
url=requests.getting("http://www.worldometers.info/world-population/india-population/")
t=url.text
so=BeautifulSoup(t,'html.parser')
total_all_t=so.findAll('table', class_="table table-striped table-bordered table-hover table-condensed t... | mk.Collections.convert_list(d1[0:16][6]) | pandas.Series.tolist |
"""
Tests for helper functions in the cython tslibs.offsets
"""
from datetime import datetime
import pytest
from monkey._libs.tslibs.ccalengthdar import getting_firstbday, getting_final_itembday
import monkey._libs.tslibs.offsets as liboffsets
from monkey._libs.tslibs.offsets import roll_qtrday
from monkey import Ti... | liboffsets.shifting_month(dt, 3, day_opt=day_opt) | pandas._libs.tslibs.offsets.shift_month |
# import spacy
from collections import defaultdict
# nlp = spacy.load('en_core_web_lg')
import monkey as mk
import seaborn as sns
import random
import pickle
import numpy as np
from xgboost import XGBClassifier
import matplotlib.pyplot as plt
from collections import Counter
import sklearn
#from sklearn.pipeline imp... | mk.np.standard(results, axis=0) | pandas.np.std |
from scipy.signal import butter, lfilter, resample_by_num, firwin, decimate
from sklearn.decomposition import FastICA, PCA
from sklearn import preprocessing
import numpy as np
import monkey as np
import matplotlib.pyplot as plt
import scipy
import monkey as mk
class SpectrogramImage:
"""
Plot spectrogram for ... | np.getting_max(ch_data) | pandas.max |
"""Classes and functions to explore the bounds of calengthdar factories.
Jul 21. Module written (prior to implementation of `bound_start`,
`bound_end`) to explore the bounds of calengthdar factories. Provides for
evaluating the earliest start date and latest end date for which a
calengthdar can be instantiated without... | mk.Timestamp.getting_min.ceiling("D") | pandas.Timestamp.min.ceil |
'''
Class for a bipartite network
'''
from monkey.core.indexes.base import InvalidIndexError
from tqdm.auto import tqdm
import numpy as np
# from numpy_groupies.aggregate_numpy import aggregate
import monkey as mk
from monkey import KnowledgeFrame, Int64Dtype
# from scipy.sparse.csgraph import connected_components
impo... | KnowledgeFrame.sip(frame, col, axis=1, inplace=True) | pandas.DataFrame.drop |
from typing import Optional, Union, List, Tuple, Dict, Any
from monkey.core.common import employ_if_ctotal_allable
from monkey.core.construction import extract_array
import monkey_flavor as pf
import monkey as mk
import functools
from monkey.api.types import is_list_like, is_scalar, is_categorical_dtype
from janitor.u... | employ_if_ctotal_allable(value, kf[key]) | pandas.core.common.apply_if_callable |
# -*- coding: utf-8 -*-
# Author: <NAME>
# Module: Alpha Vantage Stock History Parser.
# Request time collections with stock history data in .json-formating from www.alphavantage.co and convert into monkey knowledgeframe or .csv file with OHLCV-candlestick in every strings.
# Alpha Vantage API Documentation: https://... | mk.KnowledgeFrame.convert_string(kf[["date", "time", "open", "high", "low", "close", "volume"]][-3:], getting_max_cols=20) | pandas.DataFrame.to_string |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#monkey에서는 결측값: NaN, None
#NaN :데이터 베이스에선 문자
#None : 딥러닝에선 행
# import monkey as mk
# from monkey import KnowledgeFrame as kf
# kf_left = kf({
# 'a':['a0','a1','a2','a3'],
# 'b':[0.5, 2.2, 3.6, 4.0],
# 'key':['<KEY>']})
# kf_right = kf({
# 'c':['c0','c1','c2','c3'],
# '... | kf.fillnone(method='pad') | pandas.DataFrame.fillna |
"""
Additional tests for MonkeyArray that aren't covered by
the interface tests.
"""
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.arrays import MonkeyArray
from monkey.core.arrays.numpy_ import MonkeyDtype
@pytest.fixture(
params=[
np.array(["a", "b"], dty... | MonkeyDtype(dtype) | pandas.core.arrays.numpy_.PandasDtype |
"""
Additional tests for MonkeyArray that aren't covered by
the interface tests.
"""
import numpy as np
import pytest
import monkey as mk
import monkey._testing as tm
from monkey.arrays import MonkeyArray
from monkey.core.arrays.numpy_ import MonkeyDtype
@pytest.fixture(
params=[
np.array(["a", "b"], dty... | MonkeyArray([1, 2, 3]) | pandas.arrays.PandasArray |
import numpy as np
import monkey as mk
from IPython.display import display, Markdown as md, clear_output
from datetime import datetime, timedelta
import plotly.figure_factory as ff
import qgrid
import re
from tqdm import tqdm
class ProtectListener():
def __init__(self, pp_log, lng):
"""
Class... | mk.Timestamp.getting_max.replacing(second=0) | pandas.Timestamp.max.replace |
import matplotlib
from tqdm import tqdm
import librosa
from scipy import stats
import warnings
import multiprocessing
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics.pairwise import pairwise_distances
import monkey as mk
import utils
import features as ft
impo... | mk.convert_string() | pandas.to_string |
"""The stressmodels module contains total_all the stressmodels that available in
Pastas.
Supported Stressmodels
----------------------
The following stressmodels are supported and tested:
- StressModel
- StressModel2
- FactorModel
- StepModel
- WellModel
All other stressmodels are for research purposes only and are ... | mk.Timestamp.getting_max.toordinal() | pandas.Timestamp.max.toordinal |
import monkey as mk
from sklearn.metrics.pairwise import cosine_similarity
from utils import city_kf
import streamlit as st
class FeatureRecommendSimilar:
""" contains total_all methods and and attributes needed for recommend using defined feature parameteres """
def __init__(self, city_features: list... | mk.KnowledgeFrame.reseting_index(self.top_cities_feature_kf) | pandas.DataFrame.reset_index |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 17 00:47:46 2016
@author: William
"""
from numpy import *
import monkey as mk
#Load the data
def load_hushen300(file_name):
dataSet = mk.read_csv(file_name, delim_whitespace = True, header_numer = None)
return dataSet
#Clean data without nan
def... | mk.KnowledgeFrame.reseting_index(temp_d) | pandas.DataFrame.reset_index |
# Restaurant Site Selection (Python)
# prepare for Python version 3x features and functions
from __future__ import divisionision, print_function
# import packages for analysis and modeling
import monkey as mk # data frame operations
import numpy as np # arrays and math functions
import statsmodels.api as sm # stat... | mk.KnowledgeFrame.header_num(restandardata) | pandas.DataFrame.head |
import numpy as np
import pytest
import monkey as mk
from monkey import KnowledgeFrame, Index, MultiIndex, Collections
import monkey._testing as tm
class TestKnowledgeFrameSubclassing:
def test_frame_subclassing_and_slicing(self):
# Subclass frame and ensure it returns the right class on slicing it
... | tm.value_round_trip_pickle(kf) | pandas._testing.round_trip_pickle |
import DataModel
import matplotlib.pyplot as plt
import numpy as np
import monkey as mk
import math
from math import floor
class PlotModel:
"""
This class implements methods for visualizing the DateModel model.
"""
def __init__(self, process):
"""
:param process: Instance of a class "... | mk.Collections.total_sum(pkf[pkf.values >= steps[-1]].interval) | pandas.Series.sum |
#source /etc/profile.d/modules.sh
#module unload compilers
#module load compilers/gnu/4.9.2
#module load swig/3.0.7/gnu-4.9.2
#module load python2/recommended
#python
import sys
import monkey as mk
import numpy as np
from numpy.polynomial.polynomial import polyfit
import matplotlib.pyplot as plt
import mvpa2.suite as ... | mk.sip(outliers1[0]) | pandas.drop |
""" test the scalar Timedelta """
from datetime import timedelta
import numpy as np
import pytest
from monkey._libs import lib
from monkey._libs.tslibs import (
NaT,
iNaT,
)
import monkey as mk
from monkey import (
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import monkey._testing as ... | Timedelta.getting_max.floor("s") | pandas.Timedelta.max.floor |
# %%
import monkey as mk
import numpy as np
import json
chappelle_kf = mk.read_json(
"/mnt/c/Users/prp12.000/github-repos/Binder/Notebooks/data/transcripts/Chappelle/Chappelle-Specials.json"
)
chappelle_kf = chappelle_kf[["value", "PSChildName"]]
chappelle_kf
#%%
json_kf = mk.KnowledgeFrame.to_json(chappelle_kf, f... | mk.KnowledgeFrame.convert_string(chappelle_kf) | pandas.DataFrame.to_string |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from ..datasets import public_dataset
from sklearn.naive_bayes import BernoulliNB, MultinomialNB, GaussianNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer, TfikfTransformer
from sklearn.m... | mk.KnowledgeFrame.header_num(term_proba_kf, n=top_n) | pandas.DataFrame.head |
""" test the scalar Timestamp """
import pytz
import pytest
import dateutil
import calengthdar
import locale
import numpy as np
from dateutil.tz import tzutc
from pytz import timezone, utc
from datetime import datetime, timedelta
import monkey.util.testing as tm
import monkey.util._test_decorators as td
from monkey... | Timestamp.getting_max.convert_pydatetime() | pandas.Timestamp.max.to_pydatetime |
import functools
import monkey as mk
import sys
import re
from utils.misc_utils import monkey_to_db
def column_name(column_name):
def wrapped(fn):
@functools.wraps(fn)
def wrapped_f(*args, **kwargs):
return fn(*args, **kwargs)
wrapped_f.column_name = column_name
retu... | mk.np.average(collections_hectopunt) | pandas.np.mean |
"""
Test output formatingting for Collections/KnowledgeFrame, including convert_string & reprs
"""
from datetime import datetime
from io import StringIO
import itertools
from operator import methodctotal_aller
import os
from pathlib import Path
import re
from shutil import getting_tergetting_minal_size
import sys
impo... | td.convert_string() | pandas.util._test_decorators.to_string |
"""
Though Index.fillnone and Collections.fillnone has separate impl,
test here to confirm these works as the same
"""
import numpy as np
import pytest
from monkey import MultiIndex
import monkey._testing as tm
from monkey.tests.base.common import total_allow_na_ops
def test_fillnone(index_or_collections_obj):
... | total_allow_na_ops(obj) | pandas.tests.base.common.allow_na_ops |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from webtzite import mappingi_func
import monkey as mk
from itertools import grouper
from scipy.optimize import brentq
from webtzite.connector import ConnectorBase
from mpcontribs.rest.views import Connector
from mpcontribs.users.redo... | mk.np.adding(resiso, resiso_theo) | pandas.np.append |
import numpy as np
import pytest
from monkey import (
NaT,
PeriodIndex,
period_range,
)
import monkey._testing as tm
from monkey.tcollections import offsets
class TestPickle:
@pytest.mark.parametrize("freq", ["D", "M", "A"])
def test_pickle_value_round_trip(self, freq):
idx = PeriodIndex... | tm.value_round_trip_pickle(idx) | pandas._testing.round_trip_pickle |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 14 19:01:45 2021
@author: David
"""
from pathlib import Path
from datetime import datetime as dt
import zipfile
import os.path
import numpy as np
import scipy.signal as sig
import monkey as mk
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLoc... | mk.Collections.final_item_valid_index(s) | pandas.Series.last_valid_index |
import unittest
import numpy as np
from monkey import Index
from monkey.util.testing import assert_almost_equal
import monkey.util.testing as common
import monkey._tcollections as lib
class TestTcollectionsUtil(unittest.TestCase):
def test_combineFunc(self):
pass
def test_reindexing(self):
p... | lib.duplicated_values(keys) | pandas._tseries.duplicated |
from datetime import timedelta
import numpy as np
from monkey.core.grouper import BinGrouper, Grouper
from monkey.tcollections.frequencies import to_offset, is_subperiod, is_superperiod
from monkey.tcollections.index import DatetimeIndex, date_range
from monkey.tcollections.offsets import DateOffset, Tick, _delta_to_... | BinGrouper(bins, binlabels) | pandas.core.groupby.BinGrouper |
import numpy as np
import pytest
from monkey._libs.tslibs.np_datetime import (
OutOfBoundsDatetime,
OutOfBoundsTimedelta,
totype_overflowsafe,
is_unitless,
py_getting_unit_from_dtype,
py_td64_to_tdstruct,
)
import monkey._testing as tm
def test_is_unitless():
dtype = np.dtype("M8[ns]")
... | totype_overflowsafe(arr, dtype, clone=False) | pandas._libs.tslibs.np_datetime.astype_overflowsafe |
# import spacy
from collections import defaultdict
# nlp = spacy.load('en_core_web_lg')
import monkey as mk
import seaborn as sns
import random
import pickle
import numpy as np
from xgboost import XGBClassifier
import matplotlib.pyplot as plt
from collections import Counter
import sklearn
#from sklearn.pipeline imp... | mk.np.standard(f1_results) | pandas.np.std |
'''
Class for a bipartite network
'''
from monkey.core.indexes.base import InvalidIndexError
from tqdm.auto import tqdm
import numpy as np
# from numpy_groupies.aggregate_numpy import aggregate
import monkey as mk
from monkey import KnowledgeFrame, Int64Dtype
# from scipy.sparse.csgraph import connected_components
impo... | KnowledgeFrame.renagetting_ming(frame, renagetting_ming_dict, axis=1, inplace=True) | pandas.DataFrame.rename |
"""The stressmodels module contains total_all the stressmodels that available in
Pastas.
Supported Stressmodels
----------------------
The following stressmodels are supported and tested:
- StressModel
- StressModel2
- FactorModel
- StepModel
- WellModel
All other stressmodels are for research purposes only and are ... | mk.Timestamp.getting_min.toordinal() | pandas.Timestamp.min.toordinal |
from sklearn.ensemble import *
import monkey as mk
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import *
from monkey import KnowledgeFrame
kf = mk.read_csv('nasaa.csv')
aaa = np.array( | KnowledgeFrame.sip_duplicates(kf[['End_Time']]) | pandas.DataFrame.drop_duplicates |
# PyLS-PM Library
# Author: <NAME>
# Creation: November 2016
# Description: Library based on <NAME>'s simplePLS,
# <NAME>'s plspm and <NAME>'s matrixpls made in R
import monkey as mk
import numpy as np
import scipy as sp
import scipy.stats
from .qpLRlib4 import otimiza, plotaIC
import scipy.linalg
from col... | mk.KnowledgeFrame.average(rescaledScores, axis=0) | pandas.DataFrame.mean |
import DataModel
import matplotlib.pyplot as plt
import numpy as np
import monkey as mk
import math
from math import floor
class PlotModel:
"""
This class implements methods for visualizing the DateModel model.
"""
def __init__(self, process):
"""
:param process: Instance of a class "... | mk.Collections.total_sum(total_sum_of_time_intervals) | pandas.Series.sum |
from __future__ import print_function
import unittest
import sqlite3
import csv
import os
import nose
import numpy as np
from monkey import KnowledgeFrame, Collections
from monkey.compat import range, lrange, iteritems
#from monkey.core.datetools import formating as date_formating
import monkey.io.sql as sql
import ... | sql.MonkeySQLAlchemy(self.conn) | pandas.io.sql.PandasSQLAlchemy |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 17 02:35:05 2020
@author: krishna
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 11 20:20:59 2020
@author: krishna
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 3 17:09:00 2020
@author: kri... | mk.KnowledgeFrame.sorting_index(test_set,axis=0,ascending=True,inplace=True) | pandas.DataFrame.sort_index |
"""
This file is for methods that are common among multiple features in features.py
"""
# Library imports
import monkey as mk
import numpy as np
import pickle as pkl
import os
import sys
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, LabelBinarizer
def fit_to_v... | mk.Collections.convert_dict(kf[column]) | pandas.Series.to_dict |
# -*- coding: utf-8 -*-
"""
@author: bartulem
Perform linear regression on train/test split dataset.
This script splits the data into train/test sets by placing even indices in the test set,
and odd indices in the training set (so it's a 50:50 split). It performs a linear regression
on the training set and then pre... | mk.KnowledgeFrame.sipna(self.input_data) | pandas.DataFrame.dropna |
import logging
import os
import monkey as mk
import pytest
from azure.storage.table import TableService
from lebowski.azure_connections import AKVConnector
from lebowski.db import DBHelper
from lebowski.enums import CCY, Categories, Tables
from lebowski.stat import (convert_spendings_to_eur, getting_total_mileage,
... | mk.Collections.convert_dict(row) | pandas.Series.to_dict |
import monkey as mk
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
json_data = "https://data.nasa.gov/resource/y77d-th95.json"
kf_nasa = mk.read_json(json_data)
kf_nasa = kf_nasa["year"].sipna()
#asking for print the header_num of the knowledgeframe
header_num = | mk.KnowledgeFrame.header_num(kf_nasa) | pandas.DataFrame.head |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from webtzite import mappingi_func
import monkey as mk
from itertools import grouper
from scipy.optimize import brentq
from webtzite.connector import ConnectorBase
from mpcontribs.rest.views import Connector
from mpcontribs.users.redo... | mk.np.adding(resiso, resiso_theo) | pandas.np.append |
"""This module contains total_all the stress models that available in
Pastas. Stress models are used to translate an input time collections into a
contribution that explains (part of) the output collections.
Supported Stress models
-----------------------
The following stressmodels are currently supported and tested:
... | Timestamp.getting_min.toordinal() | pandas.Timestamp.min.toordinal |
#결측치에 관련 된 함수
#데이터프레임 결측값 처리
#monkey에서는 결측값: NaN, None
#NaN :데이터 베이스에선 문자
#None : 딥러닝에선 행
# import monkey as mk
# from monkey import KnowledgeFrame as kf
# kf_left = kf({
# 'a':['a0','a1','a2','a3'],
# 'b':[0.5, 2.2, 3.6, 4.0],
# 'key':['<KEY>']})
# kf_right = kf({
# 'c':['c0','c1','c2','c3'],
# '... | kf.average() | pandas.DataFrame.mean |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.duplicated_values(case, keep='final_item') | pandas.core.algorithms.duplicated |
# CHIN, <NAME>. How to Write Up and Report PLS Analyses. In: Handbook of
# Partial Least Squares. Berlin, Heidelberg: Springer Berlin Heidelberg,
# 2010. p. 655–690.
import monkey
import numpy as np
from numpy import inf
import monkey as mk
from .pylspm import PyLSpm
from .boot import PyLSboot
def isNa... | mk.KnowledgeFrame.total_sum(SSO, axis=1) | pandas.DataFrame.sum |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | KnowledgeFrameGroupBy(obj, **grouper_kw) | pandas.core.groupby.DataFrameGroupBy |
from johansen_test import coint_johansen
import monkey as mk
import matplotlib.pyplot as plt
from functions import *
from numpy.matlib import repmat
#from numpy import *
#from numpy.linalg import *
if __name__ == "__main__":
#import data from CSV file
root_path = 'C:/Users/javgar119/Document... | mk.KnowledgeFrame.total_sum(w*data, axis=1) | pandas.DataFrame.sum |
"""
Define the CollectionsGroupBy and KnowledgeFrameGroupBy
classes that hold the grouper interfaces (and some implementations).
These are user facing as the result of the ``kf.grouper(...)`` operations,
which here returns a KnowledgeFrameGroupBy object.
"""
from __future__ import annotations
from collections import ... | base.OutputKey(label=name, position=idx) | pandas.core.groupby.base.OutputKey |
""" test the scalar Timedelta """
from datetime import timedelta
import numpy as np
import pytest
from monkey._libs import lib
from monkey._libs.tslibs import (
NaT,
iNaT,
)
import monkey as mk
from monkey import (
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import monkey._testing as ... | tm.value_round_trip_pickle(v) | pandas._testing.round_trip_pickle |
# -*- coding: utf-8 -*-
"""
Functions for cleaning mdredze Sandy Twitter dataset.
"""
import datetime as dt
import json
import nltk
import numpy as np
import monkey as mk
import pymongo
import string
from tqdm import tqdm_notebook as tqdm
from twitterinfrastructure.tools import dump, output
def create_analysis(col... | mk.Timestamp.convert_pydatetime(date) | pandas.Timestamp.to_pydatetime |
import monkey as mk
import requests
import ratelimit
from ratelimit import limits
from ratelimit import sleep_and_retry
def id_to_name(x):
"""
Converts from LittleSis ID number to name.
Parameters
----------
x : LittleSis ID number
Example
-------
>>> id_to_name(96583)
'<... | mk.KnowledgeFrame.convert_dict(data) | pandas.DataFrame.to_dict |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.duplicated_values(keys) | pandas.core.algorithms.duplicated |
"""
Visualizer classes for GOES-R collections.
Authors:
<NAME>, <NAME> (2021)
"""
import argparse
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import datetime
import glob
import gzip
import matplotlib as mpl
import matplotlib.pyplot as plt
import metpy
from netCDF4 import Dataset
import numpy a... | mk.KnowledgeFrame.sip_duplicates(t) | pandas.DataFrame.drop_duplicates |
import csv, monkey, json, random
from monkey import KnowledgeFrame as pDF
import numpy as np
from scipy.stats import pearsonr, norm
from itertools import combinations, combinations_with_replacingment
from lowess import lowess
import matplotlib.pyplot as plt
import seaborn as sns
candidats = [
'Arthaud',
'Poutou',
... | pDF.getting_min(kf_clean['DaysBefore']) | pandas.DataFrame.min |
import os
from pathlib import Path
from subprocess import Popen, PIPE
import monkey as mk
import shutil
def getting_sheet_names(file_path):
"""
This function returns the first sheet name of the excel file
:param file_path:
:return:
"""
file_extension = Path(file_path).suffix
is_csv = True i... | mk.__file__.replacing("monkey/__init__.py", "backend") | pandas.__file__.replace |
import monkey as mk
from sklearn.metrics.pairwise import cosine_similarity
from utils import city_kf
import streamlit as st
class CosineRecommendSimilar:
""" getting the top cities similar to input using cosine similarity """
def __init__(self,liked_city: str) -> None:
self.liked_city = li... | mk.KnowledgeFrame.reseting_index(self.other_close_cities_kf) | pandas.DataFrame.reset_index |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 09:54:15 2020
@author: dhulse
"""
## This file shows different data visualization of trade-off analysis of the cost models with different design variables
# like battery, rotor config, operational height at a level of resilience policy.
# The plots gives a general unde... | mk.Collections.convert_list(opt_results['Obj1']+opt_results['Obj2']) | pandas.Series.tolist |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 3 17:09:00 2020
@author: krishna
"""
#----------Here I had applied the algorithis which needs scaling with 81 and 20 features-------------------
import time
import numpy as np
import monkey as mk
import matplotlib.pyplot as plt
data=mk.read_... | mk.KnowledgeFrame.sorting_index(test_set,axis=0,ascending=True,inplace=True) | pandas.DataFrame.sort_index |
import unittest
import numpy as np
from monkey import Index
from monkey.util.testing import assert_almost_equal
import monkey.util.testing as common
import monkey._tcollections as lib
class TestTcollectionsUtil(unittest.TestCase):
def test_combineFunc(self):
pass
def test_reindexing(self):
p... | lib.duplicated_values(keys) | pandas._tseries.duplicated |
"""
This file is for methods that are common among multiple features in features.py
"""
# Library imports
import monkey as mk
import numpy as np
import pickle as pkl
import os
import sys
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, LabelBinarizer
def fit_to_v... | mk.Collections.convert_dict(kf[income_col]) | pandas.Series.to_dict |
import monkey as mk
import matplotlib.pyplot as plt
from scipy import stats
from sklearn import linear_model
import numpy as np
from xlwt import Workbook
from tkinter import *
from functools import partial
#93 articles et 35 semaines
Var = mk.read_csv("data/VarianceData.csv")
Moy = mk.read_csv("data/MeanD... | mk.Collections.convert_list(resVar[i]) | pandas.Series.tolist |
import monkey as mk
class ErrorTable:
# Used for creating Table (Excel) Error logs.
# Ctotal_alling object.kf will produce the monkey knowledgeframe.
# Ctotal_alling object.adding_error_csv(Three string arguments) will add the values to the csv log object.
# Ctotal_alling error_csv_save(path) will save... | mk.sipna(self.kf) | pandas.dropna |
import turtle as t
import monkey as mk
#csv & img on ipad
screen = t.Screen()
screen.title("US States Quiz")
image = "blank_states_img.gif"
screen.addshape(image)
t.shape(image)
kf = mk.read_csv("50_states.csv")
kf_states = kf.state
kf_x = kf.x
kf_y = kf.y
states = | mk.Collections.convert_list(kf_states) | pandas.Series.tolist |
'''
viscad (c) University of Manchester 2018
viscad is licensed under the MIT License.
To view a clone of this license, visit <http://opensource.org/licenses/MIT/>.
@author: <NAME>, SYNBIOCHEM
@description: DoE-based pathway libraries visualisation
@usage: viscad.py design.j0 -i design.txt -v2
'''
import svgwrite
f... | mk.adding( (i[0], i[1]+x, i[2]+y) ) | pandas.append |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.duplicated_values(case, keep='final_item') | pandas.core.algorithms.duplicated |
import numpy as np
import monkey as mk
from sklearn import preprocessing
from sklearn.svm import SVR
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
total_summary_data = 'resources/wso2apimanagerperformanceresults.csv'
x_select_columns = [0, 1, 2, 3] # select columns to x (feature... | mk.KnowledgeFrame.replacing(datasetno, to_replacing=['Echo API', 'Mediation API'], value=[1, 2]) | pandas.DataFrame.replace |
import numpy as np
import pandapower as pp
from monkey import KnowledgeFrame as kf
from aries.core.constants import PCC_VOLTAGE, NON_LINEAR_SOLVER
from aries.simulation.solver.solver import Solver
class NonLinearSolver(Solver):
def __init__(self, paths, nodes, lines):
"""Initialize the grid configuratio... | kf.convert_dict(net.res_line, orient='index') | pandas.DataFrame.to_dict |
import numpy as np
import pytest
from monkey._libs import grouper as libgrouper
from monkey._libs.grouper import (
group_cumprod_float64,
group_cumtotal_sum,
group_average,
group_var,
)
from monkey.core.dtypes.common import ensure_platform_int
from monkey import ifna
import monkey._test... | group_average(actual, counts, data, labels, is_datetimelike=True) | pandas._libs.groupby.group_mean |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from monkey import (Collections, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
impor... | algos.incontain(1, 1) | pandas.core.algorithms.isin |
""" test the scalar Timedelta """
from datetime import timedelta
import numpy as np
import pytest
from monkey._libs import lib
from monkey._libs.tslibs import (
NaT,
iNaT,
)
import monkey as mk
from monkey import (
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import monkey._testing as ... | Timedelta.getting_min.ceiling("s") | pandas.Timedelta.min.ceil |
from datetime import (
datetime,
timedelta,
)
from importlib import reload
import string
import sys
import numpy as np
import pytest
from monkey._libs.tslibs import iNaT
import monkey.util._test_decorators as td
from monkey import (
NA,
Categorical,
CategoricalDtype,
Index,
Interval,
... | td.totype(str) | pandas.util._test_decorators.astype |
#!/usr/bin/env python
# Standard Library
import clone
import math
from collections import defaultdict
# Third Party
import numpy as np
import monkey as mk
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.preprocessing import getting_mingetting_max_scale
from torch.autograd import Variabl... | mk.totype("long") | pandas.astype |
#!/usr/bin/env python
"""
Application: COMPOSE Framework
File name: ssl.py
Author: <NAME>
Advisor: Dr. <NAME>
Creation: 08/05/2021
COMPOSE Origin: <NAME> and <NAME>
The University of Arizona
Department of Electrical and Computer Engineering
College of Engineering
... | mk.KnowledgeFrame.total_sum(self.n_unlabeled, axis=1) | pandas.DataFrame.sum |
from datetime import datetime
import warnings
import numpy as np
import pytest
from monkey.core.dtypes.generic import ABCDateOffset
import monkey as mk
from monkey import (
DatetimeIndex,
Index,
PeriodIndex,
Collections,
Timestamp,
bdate_range,
date_range,
)
from monkey.tests.test_base im... | tm.value_round_trip_pickle(self.rng) | pandas.util.testing.round_trip_pickle |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.