Function Mappings: Python to DolphinDB

This page shows the corresponding DolphinDB functions for selected Python functions. The DolphinDB functions listed below are supported in version 2.00.

The following python libraries are covered:

  • Function Mappings: From Python to DolphinDB
      1. Python built-in function
      1. NumPy
      1. Pandas
      1. SciPy
      1. Statsmodels
      1. sklearn
      1. TA-lib

1. Python built-in function

PythonDolphinDB
allall
anyany
inin
==eq
equalseqObj
absabs
lenstrlen / size
powpow
printprint
setset
dictdict
strstring
intint
boolbool
roundround
sliceslice
typetype / typestr
ziploop(pair, x, y)
joinconcat
formatstrReplace
sortisort
rjust /zfilllpad /rpad
lead / lagmove
itertools.productcross + join

2. NumPy

NumPyDolphinDB
numpy.medianmed
numpy.var(ddof=1)var
numpy.varvarp
numpy.covcovarMatrix
numpy.cov(fweights)wcovar
numpy.std(ddof=1)std
numpy.stdstdp
numpy.percentile / pandas.Series.percentilepercentile
numpy.quantile / pandas.Series.quantilequantile
numpy.quantilequantileSeries
numpy.corrcoefcorrMatrix
numpy.random.betarandBeta
numpy.random.binomialrandBinomial
numpy.random.chisquarerandChiSquare
numpy.random.exponentialrandExp
numpy.random.frandF
numpy.random.gammarandGamma
numpy.random.logisticrandLogistic
numpy.random.normalrandNormal
numpy.random.multivariate_normalrandMultivariateNormal
numpy.random.poissonrandPoisson
numpy.random.standard_trandStudent
numpy.random.randrand
numpy.argsortisort/isort!
numpy.averge(weight)wavg
numpy.random.uniformrandUniform
numpy.random.weibullrandWeibull
numpy.maxmax
numpy.minmin
numpy.meanmean/avg
numpy.sumsum
nump.random.normalnorm
nump.clipwinsorize

3. Pandas

PandasDolphinDB
df[column]at
pandas.Series.loc / pandas.DataFrame.locloc
pandas.Series.iat / pandas.DataFrame.iatcell
pandas.Series.iloc / pandas.DataFrame.iloccells
pandas.Series.align / pandas.DataFrame.alignalign
pandas.unique / pandas.DataFrame.unique / pandas.Series.uniquedistinct
pandas.concatconcatMatrix
pandas.DataFrame.add / pandas.Series.addwithNullFill + add
pandas.DataFrame.sub / pandas.Series.subwithNullFill + sub
pandas.DataFrame.mul / pandas.Series.mulwithNullFill + mul
pandas.DataFrame.div / pandas.Series.divwithNullFill + div / ratio
pandas.DataFrame.pivotpivot / panel
pandas.DataFrame.meltunpivot
pandas.DataFrame.merge / pandas.DataFrame.joinmerge
pandas.DataFrame.ewm.varewmVar
pandas.Series.covcovar
pandas.DataFrame.ewm.covewmCov
pandas.ewmstdewmStd
pandas.DataFrame.corr / pandas.Series.corrcorr
pandas.DataFrame.std / pandas.Series.stdstd
pandas.DataFrame.median / pandas.Series.medianmed
pandas.DataFrame.ewm.correwmCorr
pandas.DataFrame.max / pandas.Series.maxmax
pandas.DataFrame.min / pandas.Series.minmin
pandas.DataFrame.mean / pandas.Series.meanmean/avg
pandas.DataFrame.ewm.meanewmMean
pandas.DataFrame.sum / pandas.Series.sumsum
pandas.DataFrame.prod / pandas.Series.prodprod
pandas.DataFrame.nunique / pandas.Series.nuniquenunique
pandas.DataFrame.hist / pandas.Series.histplotHist
pandas.DataFrame.sem / pandas.Series.semsem
pandas.DataFrame.mad / pandas.Series.madmad (useMedian=false)
pandas.DataFrame.kurt(kurtosis) / pandas.Series.kurt(kurtosis)kurtosis
pandas.DataFrame.skew / pandas.Series.kurt(skew)skew
pandas.DataFrame.count / pandas.Series.countcount
pandas.DataFrame.idxmax / pandas.Series.idxmaximax
pandas.DataFrame.idxmin / pandas.Series.idxminimin
pandas.DataFrame.cummax / pandas.Series.cummaxcummax
pandas.DataFrame.cummin / pandas.Series.cummincummin
pandas.DataFrame.cumsum / pandas.Series.cumsumcumsum
pandas.DataFrame.cumprod / pandas.Series.cumprodcumprod
pandas.DataFrame.nlargest(nsmallest) / pandas.Series.nlargest(nsmallest)top + order by / aggrTopN
pandas.DataFrame.diff / pandas.Series.diffeachPost, deltas
pandas.DataFrame.quantile / pandas.Series.quantilequantile
pandas.DataFrame.transposetranspose
pandas.Series.resample / pandas.DataFrame.resampleresample
pandas.Series.copy / pandas.DataFrame.copycopy
pandas.Series.describe / pandas.DataFrame.describe 类似stat
pandas.DataFrame.isnull/pandas.DataFrame.isnaisNull
pandas.DataFrame.notnull/pandas.DataFrame.notnaisValid
pandas.Series.betweenbetween
pandas.Series.is_monotonic_decreasingisMonotonicIncreasing
pandas.Series.is_monotonic_increasingisMonotonicDecreasing
pandas.DataFrame.mask / pandas.Series.maskmask
pandas.DataFrame.bfill / pandas.Series.bfillbfill/bfill!
pandas.DataFrame.ffill / pandas.Series.ffillffill/ffill!
pandas.DataFrame.interpolate / pandas.Series.interpolateinterpolate
pandas.DataFrame.interpolate(method='linear') / pandas.Series.interpolate(method='linear')lfill/lfill!
pandas.DataFrame.fillna / pandas.Series.fillnanullFill/nullFill!
pandas.DataFrame.sort_values / pandas.Series.sort_valuessort/sort!
pandas.DataFrame.head / pandas.Series.headhead
pandas.DataFrame.tail / pandas.Series.tailtail
pandas.DataFrame.drop / pandas.Series.dropdropColumns!
pandas.DataFrame.dropna / pandas.Series.dropnadropna
pandas.DataFrame.renamerename!
pandas.DataFrame.append / pandas.Series.appendappend!
pandas.DataFrame.keys / pandas.Series.keysrowNames / columnNames
pandas.DataFrame.astype / pandas.Series.astypecast
pandas.DataFrame.isin / pandas.Series.isinin
pandas.Series.str.isspaceisSpace
pandas.Series.str.isalnumisAlNum
pandas.Series.str.isalphaisAlpha
pandas.Series.str.isnumericisNumeric
pandas.Series.str.isdecimalisDecimal
pandas.Series.str.isdigitisDigit
pandas.Series.str.islowerisLower
pandas.Series.str.isupperisUpper
pandas.Series.str.istitleisTitle
pandas.Series.str.startswithstartsWith
pandas.Series.str.endswithendsWith
pandas.Series.str.findregexFind
pandas.Series.str.replacestrReplace
pandas.Series.duplicated /pandas.DataFrame.duplicatedisDuplicated
pandas.Series.rank / pandas.DataFrame.rankrank
pandas.Series.rank(method='dense') / pandas.DataFrame.rank(method='dense')denseRank
pandas.read_csvloadText / loadTextEx
pandas.to_csvsaveText
pandas.read_jsonfromJson
pandas.DataFrame.to_json / pandas.Series.to_jsontoJson
pandas.DataFrame.groupby.aggFuncregroup, group by
pandas.to_datetimetemporalParse
pandas.DataFrame.rolling / pandas.Series.rollingmoving
pandas.rolling_meanmavg
pandas.rolling_stdmstd
pandas.rolling_medianmmed
pandas.DataFrame.shift / pandas.Series.shiftmove / tmove / prev / next

4. SciPy

SciPyDolphinDB
scipy.stats.percentileofscorepercentileRank
scipy.stats.spearmanr(X, Y)[0]spearmanr(X, Y)
scipy.spatial.distance.euclideaneuclidean
scipy.stats.beta.cdf(X, a, b)cdfBeta(a, b, X)
scipy.stats.binom.cdf(X, trials, p)cdfBinomial(trials, p, X)
scipy.stats.chi2.cdf(x, df)cdfChiSquare(df, X)
scipy.stats.expon.cdf(x, scale=mean)cdfExp(mean, X)
scipy.stats.f.cdf(X, dfn, dfd)cdfF(dfn, dfd, X)
scipy.stats.gamma.cdf(X, shape, scale=scale)cdfGamma(shape, scale, X)
scipy.stats.logistic.cdf(X, loc=mean,scale=scale)cdfLogistic(mean, scale, X)
scipy.stats.norm.cdf(X, loc=mean, scale=stdev)cdfNormal(mean,stdev,X)
scipy.stats.poisson.cdf(X, mu=mean)cdfPoisson(mean, X)
scipy.stats.t.cdf(X, df)cdfStudent(df, X)
scipy.stats.uniform.cdf(X, loc=lower, scale=upper-lower)cdfUniform(lower, upper, X)
scipy.stats.weibull_min.cdf(X, alpha, scale=beta)cdfWeibull(alpha, beta, X)
scipy.stats.zipfian.cdf(X, exponent, num)cdfZipf(num, exponent, X)
scipy.stats.beta.ppf(X, a, b)invBeta
scipy.stats.binom.ppf(X, trials, p)invBinomial
scipy.stats.chi2.ppf(x, df)invChiSquare
scipy.stats.expon.ppf(x, scale=mean)invExp
scipy.stats.f.ppf(X, dfn, dfd)invF
scipy.stats.gamma.ppf(X, shape, scale=scale)invGamma
scipy.stats.logistic.ppf(X, loc=mean,scale=scale)invLogistic
scipy.stats.norm.ppf(X, loc=mean, scale=stdev)invNormal
scipy.stats.poisson.ppf(X, mu=mean)invPoisson
scipy.stats.t.ppf(X, df)invStudent
scipy.stats.uniform.ppf(X, loc=lower, scale=upper-lower)invUniform
scipy.stats.weibull_min.ppf(X, alpha, scale=beta)invWeibull
scipy.stats.chisquarechiSquareTest
scipy.stats.f_onewayfTest
scipy.stats.ttest_indtTest
scipy.stats.ks_2sampksTest
scipy.stats.shapiroshapiroTest
scipy.stats.mannwhitneyumannWhitneyUTest
scipy.stats.mstats.winsorizewinsorize
scipy. stats.kurtosiskurtosis
scipy.stats.skewskew
scipy.stats.semsem
scipy.stats.zscore(ddof=1)zscore

5. Statsmodels

StatsmodelsDolphinDB
statsmodels.api.tsa.acfacf
statsmodels.tsa.seasonal.STLstl
statsmodels.stats.weightstats.ztestzTest
statsmodels.multivariate.manova.MANOVAmanova
statsmodels.api.stats.anova_lmanova
statsmodels.regression.linear_model.OLSolsolsEx
statsmodels.regression.linear_model.WLSwls

6. sklearn

sklearnDolphinDB
sklearn.linear_model.LinearRegression().fit(Y, X).coef_beta(X, Y)
sklearn.metrics.mutual_info_scoremutualInfo
sklearn.ensemble.AdaBoostClassifieradaBoostClassifier
sklearn.ensemble.AdaBoostRegressoradaBoostRegressor
sklearn.ensemble.RandomForestClassifierrandomForestClassifier
sklearn.ensemble.RandomForestRegressorrandomForestRegressor
sklearn.naive_bayes.GaussianNBgaussianNB
sklearn.naive_bayes.MultinomialNBmultinomialNB
sklearn.linear_model.LogisticRegressionlogisticRegression
sklearn.mixture.GaussianMixturegmm
sklearn.cluster.k_meanskmeans
sklearn.neighbors.KNeighborsClassifierknn
sklearn.linear_model.ElasticNetelasticNet
sklearn.linear_model.Lassolasso
sklearn.linear_model.Ridgeridge
sklearn.decomposition.PCApca

7. TA-lib

TA-libDolphinDB
talib.MAma
talib.EMAema
talib.WMAwma
talib.SMAsma
talib.TRIMAtrima
talib.TEMAtema
talib.DEMAdema
talib.KAMAkama
talib.T3t3
talib.LINEARREG_SLOPE / talib.LINEARREG_INTERCEPTlinearTimeTrend
talib.TRANGEtrueRange

The functions listed above are DolphinDB built-in functions. More TA-lib functions are provided in DolphinDB ta module. Refer to DolphinDB tutorial: Technical Analysis Indicator Library for more information.

Note: Contact us via support@dolphindb.com or comment below to send us feedback or report any problems you find.