teradataml 20.0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/LICENSE.pdf +0 -0
- teradataml/README.md +2762 -0
- teradataml/__init__.py +78 -0
- teradataml/_version.py +11 -0
- teradataml/analytics/Transformations.py +2996 -0
- teradataml/analytics/__init__.py +82 -0
- teradataml/analytics/analytic_function_executor.py +2416 -0
- teradataml/analytics/analytic_query_generator.py +1050 -0
- teradataml/analytics/byom/H2OPredict.py +514 -0
- teradataml/analytics/byom/PMMLPredict.py +437 -0
- teradataml/analytics/byom/__init__.py +16 -0
- teradataml/analytics/json_parser/__init__.py +133 -0
- teradataml/analytics/json_parser/analytic_functions_argument.py +1805 -0
- teradataml/analytics/json_parser/json_store.py +191 -0
- teradataml/analytics/json_parser/metadata.py +1666 -0
- teradataml/analytics/json_parser/utils.py +805 -0
- teradataml/analytics/meta_class.py +236 -0
- teradataml/analytics/sqle/DecisionTreePredict.py +456 -0
- teradataml/analytics/sqle/NaiveBayesPredict.py +420 -0
- teradataml/analytics/sqle/__init__.py +128 -0
- teradataml/analytics/sqle/json/decisiontreepredict_sqle.json +78 -0
- teradataml/analytics/sqle/json/naivebayespredict_sqle.json +62 -0
- teradataml/analytics/table_operator/__init__.py +11 -0
- teradataml/analytics/uaf/__init__.py +82 -0
- teradataml/analytics/utils.py +828 -0
- teradataml/analytics/valib.py +1617 -0
- teradataml/automl/__init__.py +5835 -0
- teradataml/automl/autodataprep/__init__.py +493 -0
- teradataml/automl/custom_json_utils.py +1625 -0
- teradataml/automl/data_preparation.py +1384 -0
- teradataml/automl/data_transformation.py +1254 -0
- teradataml/automl/feature_engineering.py +2273 -0
- teradataml/automl/feature_exploration.py +1873 -0
- teradataml/automl/model_evaluation.py +488 -0
- teradataml/automl/model_training.py +1407 -0
- teradataml/catalog/__init__.py +2 -0
- teradataml/catalog/byom.py +1759 -0
- teradataml/catalog/function_argument_mapper.py +859 -0
- teradataml/catalog/model_cataloging_utils.py +491 -0
- teradataml/clients/__init__.py +0 -0
- teradataml/clients/auth_client.py +137 -0
- teradataml/clients/keycloak_client.py +165 -0
- teradataml/clients/pkce_client.py +481 -0
- teradataml/common/__init__.py +1 -0
- teradataml/common/aed_utils.py +2078 -0
- teradataml/common/bulk_exposed_utils.py +113 -0
- teradataml/common/constants.py +1669 -0
- teradataml/common/deprecations.py +166 -0
- teradataml/common/exceptions.py +147 -0
- teradataml/common/formula.py +743 -0
- teradataml/common/garbagecollector.py +666 -0
- teradataml/common/logger.py +1261 -0
- teradataml/common/messagecodes.py +518 -0
- teradataml/common/messages.py +262 -0
- teradataml/common/pylogger.py +67 -0
- teradataml/common/sqlbundle.py +764 -0
- teradataml/common/td_coltype_code_to_tdtype.py +48 -0
- teradataml/common/utils.py +3166 -0
- teradataml/common/warnings.py +36 -0
- teradataml/common/wrapper_utils.py +625 -0
- teradataml/config/__init__.py +0 -0
- teradataml/config/dummy_file1.cfg +5 -0
- teradataml/config/dummy_file2.cfg +3 -0
- teradataml/config/sqlengine_alias_definitions_v1.0 +14 -0
- teradataml/config/sqlengine_alias_definitions_v1.1 +20 -0
- teradataml/config/sqlengine_alias_definitions_v1.3 +19 -0
- teradataml/context/__init__.py +0 -0
- teradataml/context/aed_context.py +223 -0
- teradataml/context/context.py +1462 -0
- teradataml/data/A_loan.csv +19 -0
- teradataml/data/BINARY_REALS_LEFT.csv +11 -0
- teradataml/data/BINARY_REALS_RIGHT.csv +11 -0
- teradataml/data/B_loan.csv +49 -0
- teradataml/data/BuoyData2.csv +17 -0
- teradataml/data/CONVOLVE2_COMPLEX_LEFT.csv +5 -0
- teradataml/data/CONVOLVE2_COMPLEX_RIGHT.csv +5 -0
- teradataml/data/Convolve2RealsLeft.csv +5 -0
- teradataml/data/Convolve2RealsRight.csv +5 -0
- teradataml/data/Convolve2ValidLeft.csv +11 -0
- teradataml/data/Convolve2ValidRight.csv +11 -0
- teradataml/data/DFFTConv_Real_8_8.csv +65 -0
- teradataml/data/Employee.csv +5 -0
- teradataml/data/Employee_Address.csv +4 -0
- teradataml/data/Employee_roles.csv +5 -0
- teradataml/data/JulesBelvezeDummyData.csv +100 -0
- teradataml/data/Mall_customer_data.csv +201 -0
- teradataml/data/Orders1_12mf.csv +25 -0
- teradataml/data/Pi_loan.csv +7 -0
- teradataml/data/SMOOTHED_DATA.csv +7 -0
- teradataml/data/TestDFFT8.csv +9 -0
- teradataml/data/TestRiver.csv +109 -0
- teradataml/data/Traindata.csv +28 -0
- teradataml/data/__init__.py +0 -0
- teradataml/data/acf.csv +17 -0
- teradataml/data/adaboost_example.json +34 -0
- teradataml/data/adaboostpredict_example.json +24 -0
- teradataml/data/additional_table.csv +11 -0
- teradataml/data/admissions_test.csv +21 -0
- teradataml/data/admissions_train.csv +41 -0
- teradataml/data/admissions_train_nulls.csv +41 -0
- teradataml/data/advertising.csv +201 -0
- teradataml/data/ageandheight.csv +13 -0
- teradataml/data/ageandpressure.csv +31 -0
- teradataml/data/amazon_reviews_25.csv +26 -0
- teradataml/data/antiselect_example.json +36 -0
- teradataml/data/antiselect_input.csv +8 -0
- teradataml/data/antiselect_input_mixed_case.csv +8 -0
- teradataml/data/applicant_external.csv +7 -0
- teradataml/data/applicant_reference.csv +7 -0
- teradataml/data/apriori_example.json +22 -0
- teradataml/data/arima_example.json +9 -0
- teradataml/data/assortedtext_input.csv +8 -0
- teradataml/data/attribution_example.json +34 -0
- teradataml/data/attribution_sample_table.csv +27 -0
- teradataml/data/attribution_sample_table1.csv +6 -0
- teradataml/data/attribution_sample_table2.csv +11 -0
- teradataml/data/bank_churn.csv +10001 -0
- teradataml/data/bank_marketing.csv +11163 -0
- teradataml/data/bank_web_clicks1.csv +43 -0
- teradataml/data/bank_web_clicks2.csv +91 -0
- teradataml/data/bank_web_url.csv +85 -0
- teradataml/data/barrier.csv +2 -0
- teradataml/data/barrier_new.csv +3 -0
- teradataml/data/betweenness_example.json +14 -0
- teradataml/data/bike_sharing.csv +732 -0
- teradataml/data/bin_breaks.csv +8 -0
- teradataml/data/bin_fit_ip.csv +4 -0
- teradataml/data/binary_complex_left.csv +11 -0
- teradataml/data/binary_complex_right.csv +11 -0
- teradataml/data/binary_matrix_complex_left.csv +21 -0
- teradataml/data/binary_matrix_complex_right.csv +21 -0
- teradataml/data/binary_matrix_real_left.csv +21 -0
- teradataml/data/binary_matrix_real_right.csv +21 -0
- teradataml/data/blood2ageandweight.csv +26 -0
- teradataml/data/bmi.csv +501 -0
- teradataml/data/boston.csv +507 -0
- teradataml/data/boston2cols.csv +721 -0
- teradataml/data/breast_cancer.csv +570 -0
- teradataml/data/buoydata_mix.csv +11 -0
- teradataml/data/burst_data.csv +5 -0
- teradataml/data/burst_example.json +21 -0
- teradataml/data/byom_example.json +34 -0
- teradataml/data/bytes_table.csv +4 -0
- teradataml/data/cal_housing_ex_raw.csv +70 -0
- teradataml/data/callers.csv +7 -0
- teradataml/data/calls.csv +10 -0
- teradataml/data/cars_hist.csv +33 -0
- teradataml/data/cat_table.csv +25 -0
- teradataml/data/ccm_example.json +32 -0
- teradataml/data/ccm_input.csv +91 -0
- teradataml/data/ccm_input2.csv +13 -0
- teradataml/data/ccmexample.csv +101 -0
- teradataml/data/ccmprepare_example.json +9 -0
- teradataml/data/ccmprepare_input.csv +91 -0
- teradataml/data/cfilter_example.json +12 -0
- teradataml/data/changepointdetection_example.json +18 -0
- teradataml/data/changepointdetectionrt_example.json +8 -0
- teradataml/data/chi_sq.csv +3 -0
- teradataml/data/churn_data.csv +14 -0
- teradataml/data/churn_emission.csv +35 -0
- teradataml/data/churn_initial.csv +3 -0
- teradataml/data/churn_state_transition.csv +5 -0
- teradataml/data/citedges_2.csv +745 -0
- teradataml/data/citvertices_2.csv +1210 -0
- teradataml/data/clicks2.csv +16 -0
- teradataml/data/clickstream.csv +13 -0
- teradataml/data/clickstream1.csv +11 -0
- teradataml/data/closeness_example.json +16 -0
- teradataml/data/complaints.csv +21 -0
- teradataml/data/complaints_mini.csv +3 -0
- teradataml/data/complaints_test_tokenized.csv +353 -0
- teradataml/data/complaints_testtoken.csv +224 -0
- teradataml/data/complaints_tokens_model.csv +348 -0
- teradataml/data/complaints_tokens_test.csv +353 -0
- teradataml/data/complaints_traintoken.csv +472 -0
- teradataml/data/computers_category.csv +1001 -0
- teradataml/data/computers_test1.csv +1252 -0
- teradataml/data/computers_train1.csv +5009 -0
- teradataml/data/computers_train1_clustered.csv +5009 -0
- teradataml/data/confusionmatrix_example.json +9 -0
- teradataml/data/conversion_event_table.csv +3 -0
- teradataml/data/corr_input.csv +17 -0
- teradataml/data/correlation_example.json +11 -0
- teradataml/data/covid_confirm_sd.csv +83 -0
- teradataml/data/coxhazardratio_example.json +39 -0
- teradataml/data/coxph_example.json +15 -0
- teradataml/data/coxsurvival_example.json +28 -0
- teradataml/data/cpt.csv +41 -0
- teradataml/data/credit_ex_merged.csv +45 -0
- teradataml/data/creditcard_data.csv +1001 -0
- teradataml/data/customer_loyalty.csv +301 -0
- teradataml/data/customer_loyalty_newseq.csv +31 -0
- teradataml/data/customer_segmentation_test.csv +2628 -0
- teradataml/data/customer_segmentation_train.csv +8069 -0
- teradataml/data/dataframe_example.json +173 -0
- teradataml/data/decisionforest_example.json +37 -0
- teradataml/data/decisionforestpredict_example.json +38 -0
- teradataml/data/decisiontree_example.json +21 -0
- teradataml/data/decisiontreepredict_example.json +45 -0
- teradataml/data/dfft2_size4_real.csv +17 -0
- teradataml/data/dfft2_test_matrix16.csv +17 -0
- teradataml/data/dfft2conv_real_4_4.csv +65 -0
- teradataml/data/diabetes.csv +443 -0
- teradataml/data/diabetes_test.csv +89 -0
- teradataml/data/dict_table.csv +5 -0
- teradataml/data/docperterm_table.csv +4 -0
- teradataml/data/docs/__init__.py +1 -0
- teradataml/data/docs/byom/__init__.py +0 -0
- teradataml/data/docs/byom/docs/DataRobotPredict.py +180 -0
- teradataml/data/docs/byom/docs/DataikuPredict.py +217 -0
- teradataml/data/docs/byom/docs/H2OPredict.py +325 -0
- teradataml/data/docs/byom/docs/ONNXEmbeddings.py +242 -0
- teradataml/data/docs/byom/docs/ONNXPredict.py +283 -0
- teradataml/data/docs/byom/docs/ONNXSeq2Seq.py +255 -0
- teradataml/data/docs/byom/docs/PMMLPredict.py +278 -0
- teradataml/data/docs/byom/docs/__init__.py +0 -0
- teradataml/data/docs/sqle/__init__.py +0 -0
- teradataml/data/docs/sqle/docs_17_10/Antiselect.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/Attribution.py +200 -0
- teradataml/data/docs/sqle/docs_17_10/BincodeFit.py +172 -0
- teradataml/data/docs/sqle/docs_17_10/BincodeTransform.py +131 -0
- teradataml/data/docs/sqle/docs_17_10/CategoricalSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_10/ChiSq.py +90 -0
- teradataml/data/docs/sqle/docs_17_10/ColumnSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_10/ConvertTo.py +96 -0
- teradataml/data/docs/sqle/docs_17_10/DecisionForestPredict.py +139 -0
- teradataml/data/docs/sqle/docs_17_10/DecisionTreePredict.py +152 -0
- teradataml/data/docs/sqle/docs_17_10/FTest.py +161 -0
- teradataml/data/docs/sqle/docs_17_10/FillRowId.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/Fit.py +88 -0
- teradataml/data/docs/sqle/docs_17_10/GLMPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithMissingValues.py +85 -0
- teradataml/data/docs/sqle/docs_17_10/GetRowsWithoutMissingValues.py +82 -0
- teradataml/data/docs/sqle/docs_17_10/Histogram.py +165 -0
- teradataml/data/docs/sqle/docs_17_10/MovingAverage.py +134 -0
- teradataml/data/docs/sqle/docs_17_10/NGramSplitter.py +209 -0
- teradataml/data/docs/sqle/docs_17_10/NPath.py +266 -0
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesPredict.py +116 -0
- teradataml/data/docs/sqle/docs_17_10/NaiveBayesTextClassifierPredict.py +176 -0
- teradataml/data/docs/sqle/docs_17_10/NumApply.py +147 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingFit.py +135 -0
- teradataml/data/docs/sqle/docs_17_10/OneHotEncodingTransform.py +109 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterFit.py +166 -0
- teradataml/data/docs/sqle/docs_17_10/OutlierFilterTransform.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/Pack.py +128 -0
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesFit.py +112 -0
- teradataml/data/docs/sqle/docs_17_10/PolynomialFeaturesTransform.py +102 -0
- teradataml/data/docs/sqle/docs_17_10/QQNorm.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/RoundColumns.py +110 -0
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeFit.py +118 -0
- teradataml/data/docs/sqle/docs_17_10/RowNormalizeTransform.py +99 -0
- teradataml/data/docs/sqle/docs_17_10/SVMSparsePredict.py +153 -0
- teradataml/data/docs/sqle/docs_17_10/ScaleFit.py +197 -0
- teradataml/data/docs/sqle/docs_17_10/ScaleTransform.py +99 -0
- teradataml/data/docs/sqle/docs_17_10/Sessionize.py +114 -0
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeFit.py +116 -0
- teradataml/data/docs/sqle/docs_17_10/SimpleImputeTransform.py +98 -0
- teradataml/data/docs/sqle/docs_17_10/StrApply.py +187 -0
- teradataml/data/docs/sqle/docs_17_10/StringSimilarity.py +146 -0
- teradataml/data/docs/sqle/docs_17_10/Transform.py +105 -0
- teradataml/data/docs/sqle/docs_17_10/UnivariateStatistics.py +142 -0
- teradataml/data/docs/sqle/docs_17_10/Unpack.py +214 -0
- teradataml/data/docs/sqle/docs_17_10/WhichMax.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/WhichMin.py +83 -0
- teradataml/data/docs/sqle/docs_17_10/ZTest.py +155 -0
- teradataml/data/docs/sqle/docs_17_10/__init__.py +0 -0
- teradataml/data/docs/sqle/docs_17_20/ANOVA.py +186 -0
- teradataml/data/docs/sqle/docs_17_20/Antiselect.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/Apriori.py +138 -0
- teradataml/data/docs/sqle/docs_17_20/Attribution.py +201 -0
- teradataml/data/docs/sqle/docs_17_20/BincodeFit.py +172 -0
- teradataml/data/docs/sqle/docs_17_20/BincodeTransform.py +139 -0
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/CategoricalSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_20/ChiSq.py +90 -0
- teradataml/data/docs/sqle/docs_17_20/ClassificationEvaluator.py +166 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnSummary.py +86 -0
- teradataml/data/docs/sqle/docs_17_20/ColumnTransformer.py +246 -0
- teradataml/data/docs/sqle/docs_17_20/ConvertTo.py +113 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionForest.py +280 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionForestPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/DecisionTreePredict.py +136 -0
- teradataml/data/docs/sqle/docs_17_20/FTest.py +240 -0
- teradataml/data/docs/sqle/docs_17_20/FillRowId.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/Fit.py +88 -0
- teradataml/data/docs/sqle/docs_17_20/GLM.py +541 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPerSegment.py +415 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/GLMPredictPerSegment.py +233 -0
- teradataml/data/docs/sqle/docs_17_20/GetFutileColumns.py +125 -0
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithMissingValues.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/GetRowsWithoutMissingValues.py +106 -0
- teradataml/data/docs/sqle/docs_17_20/Histogram.py +224 -0
- teradataml/data/docs/sqle/docs_17_20/KMeans.py +251 -0
- teradataml/data/docs/sqle/docs_17_20/KMeansPredict.py +144 -0
- teradataml/data/docs/sqle/docs_17_20/KNN.py +215 -0
- teradataml/data/docs/sqle/docs_17_20/MovingAverage.py +134 -0
- teradataml/data/docs/sqle/docs_17_20/NERExtractor.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/NGramSplitter.py +209 -0
- teradataml/data/docs/sqle/docs_17_20/NPath.py +266 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesPredict.py +116 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierPredict.py +177 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayesTextClassifierTrainer.py +127 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineFit.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/NonLinearCombineTransform.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/NumApply.py +147 -0
- teradataml/data/docs/sqle/docs_17_20/OneClassSVM.py +307 -0
- teradataml/data/docs/sqle/docs_17_20/OneClassSVMPredict.py +185 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingFit.py +231 -0
- teradataml/data/docs/sqle/docs_17_20/OneHotEncodingTransform.py +121 -0
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingFit.py +220 -0
- teradataml/data/docs/sqle/docs_17_20/OrdinalEncodingTransform.py +127 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +191 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterTransform.py +117 -0
- teradataml/data/docs/sqle/docs_17_20/Pack.py +128 -0
- teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesFit.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/PolynomialFeaturesTransform.py +112 -0
- teradataml/data/docs/sqle/docs_17_20/QQNorm.py +105 -0
- teradataml/data/docs/sqle/docs_17_20/ROC.py +164 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionFit.py +155 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionMinComponents.py +106 -0
- teradataml/data/docs/sqle/docs_17_20/RandomProjectionTransform.py +120 -0
- teradataml/data/docs/sqle/docs_17_20/RegressionEvaluator.py +211 -0
- teradataml/data/docs/sqle/docs_17_20/RoundColumns.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeFit.py +118 -0
- teradataml/data/docs/sqle/docs_17_20/RowNormalizeTransform.py +111 -0
- teradataml/data/docs/sqle/docs_17_20/SMOTE.py +212 -0
- teradataml/data/docs/sqle/docs_17_20/SVM.py +414 -0
- teradataml/data/docs/sqle/docs_17_20/SVMPredict.py +213 -0
- teradataml/data/docs/sqle/docs_17_20/SVMSparsePredict.py +153 -0
- teradataml/data/docs/sqle/docs_17_20/ScaleFit.py +315 -0
- teradataml/data/docs/sqle/docs_17_20/ScaleTransform.py +202 -0
- teradataml/data/docs/sqle/docs_17_20/SentimentExtractor.py +206 -0
- teradataml/data/docs/sqle/docs_17_20/Sessionize.py +114 -0
- teradataml/data/docs/sqle/docs_17_20/Shap.py +225 -0
- teradataml/data/docs/sqle/docs_17_20/Silhouette.py +153 -0
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeFit.py +116 -0
- teradataml/data/docs/sqle/docs_17_20/SimpleImputeTransform.py +109 -0
- teradataml/data/docs/sqle/docs_17_20/StrApply.py +187 -0
- teradataml/data/docs/sqle/docs_17_20/StringSimilarity.py +146 -0
- teradataml/data/docs/sqle/docs_17_20/TDDecisionForestPredict.py +207 -0
- teradataml/data/docs/sqle/docs_17_20/TDGLMPredict.py +333 -0
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
- teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingFit.py +267 -0
- teradataml/data/docs/sqle/docs_17_20/TargetEncodingTransform.py +141 -0
- teradataml/data/docs/sqle/docs_17_20/TextMorph.py +119 -0
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +224 -0
- teradataml/data/docs/sqle/docs_17_20/TrainTestSplit.py +160 -0
- teradataml/data/docs/sqle/docs_17_20/Transform.py +123 -0
- teradataml/data/docs/sqle/docs_17_20/UnivariateStatistics.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/Unpack.py +214 -0
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/sqle/docs_17_20/VectorDistance.py +169 -0
- teradataml/data/docs/sqle/docs_17_20/WhichMax.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/WhichMin.py +83 -0
- teradataml/data/docs/sqle/docs_17_20/WordEmbeddings.py +237 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoost.py +362 -0
- teradataml/data/docs/sqle/docs_17_20/XGBoostPredict.py +281 -0
- teradataml/data/docs/sqle/docs_17_20/ZTest.py +220 -0
- teradataml/data/docs/sqle/docs_17_20/__init__.py +0 -0
- teradataml/data/docs/tableoperator/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_00/ReadNOS.py +430 -0
- teradataml/data/docs/tableoperator/docs_17_00/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_05/ReadNOS.py +430 -0
- teradataml/data/docs/tableoperator/docs_17_05/WriteNOS.py +348 -0
- teradataml/data/docs/tableoperator/docs_17_05/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_10/ReadNOS.py +429 -0
- teradataml/data/docs/tableoperator/docs_17_10/WriteNOS.py +348 -0
- teradataml/data/docs/tableoperator/docs_17_10/__init__.py +0 -0
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- teradataml/data/docs/tableoperator/docs_17_20/ReadNOS.py +440 -0
- teradataml/data/docs/tableoperator/docs_17_20/WriteNOS.py +387 -0
- teradataml/data/docs/tableoperator/docs_17_20/__init__.py +0 -0
- teradataml/data/docs/uaf/__init__.py +0 -0
- teradataml/data/docs/uaf/docs_17_20/ACF.py +186 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +370 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +172 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +161 -0
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
- teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
- teradataml/data/docs/uaf/docs_17_20/BinaryMatrixOp.py +248 -0
- teradataml/data/docs/uaf/docs_17_20/BinarySeriesOp.py +252 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +178 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +175 -0
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +230 -0
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +218 -0
- teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +185 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT.py +204 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT2.py +216 -0
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +216 -0
- teradataml/data/docs/uaf/docs_17_20/DFFTConv.py +192 -0
- teradataml/data/docs/uaf/docs_17_20/DIFF.py +175 -0
- teradataml/data/docs/uaf/docs_17_20/DTW.py +180 -0
- teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +217 -0
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +142 -0
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +184 -0
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +185 -0
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
- teradataml/data/docs/uaf/docs_17_20/FitMetrics.py +172 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesFormula.py +206 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +143 -0
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +198 -0
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +260 -0
- teradataml/data/docs/uaf/docs_17_20/IDFFT.py +165 -0
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +191 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
- teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/InputValidator.py +121 -0
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +156 -0
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +215 -0
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +174 -0
- teradataml/data/docs/uaf/docs_17_20/MInfo.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/MultivarRegr.py +191 -0
- teradataml/data/docs/uaf/docs_17_20/PACF.py +157 -0
- teradataml/data/docs/uaf/docs_17_20/Portman.py +217 -0
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +203 -0
- teradataml/data/docs/uaf/docs_17_20/PowerTransform.py +155 -0
- teradataml/data/docs/uaf/docs_17_20/Resample.py +237 -0
- teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
- teradataml/data/docs/uaf/docs_17_20/SInfo.py +123 -0
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +173 -0
- teradataml/data/docs/uaf/docs_17_20/SelectionCriteria.py +174 -0
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/SignifResidmean.py +164 -0
- teradataml/data/docs/uaf/docs_17_20/SimpleExp.py +180 -0
- teradataml/data/docs/uaf/docs_17_20/Smoothma.py +208 -0
- teradataml/data/docs/uaf/docs_17_20/TrackingOp.py +151 -0
- teradataml/data/docs/uaf/docs_17_20/UNDIFF.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/Unnormalize.py +202 -0
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +171 -0
- teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
- teradataml/data/docs/uaf/docs_17_20/__init__.py +0 -0
- teradataml/data/dtw_example.json +18 -0
- teradataml/data/dtw_t1.csv +11 -0
- teradataml/data/dtw_t2.csv +4 -0
- teradataml/data/dwt2d_dataTable.csv +65 -0
- teradataml/data/dwt2d_example.json +16 -0
- teradataml/data/dwt_dataTable.csv +8 -0
- teradataml/data/dwt_example.json +15 -0
- teradataml/data/dwt_filterTable.csv +3 -0
- teradataml/data/dwt_filter_dim.csv +5 -0
- teradataml/data/emission.csv +9 -0
- teradataml/data/emp_table_by_dept.csv +19 -0
- teradataml/data/employee_info.csv +4 -0
- teradataml/data/employee_table.csv +6 -0
- teradataml/data/excluding_event_table.csv +2 -0
- teradataml/data/finance_data.csv +6 -0
- teradataml/data/finance_data2.csv +61 -0
- teradataml/data/finance_data3.csv +93 -0
- teradataml/data/finance_data4.csv +13 -0
- teradataml/data/fish.csv +160 -0
- teradataml/data/fm_blood2ageandweight.csv +26 -0
- teradataml/data/fmeasure_example.json +12 -0
- teradataml/data/followers_leaders.csv +10 -0
- teradataml/data/fpgrowth_example.json +12 -0
- teradataml/data/frequentpaths_example.json +29 -0
- teradataml/data/friends.csv +9 -0
- teradataml/data/fs_input.csv +33 -0
- teradataml/data/fs_input1.csv +33 -0
- teradataml/data/genData.csv +513 -0
- teradataml/data/geodataframe_example.json +40 -0
- teradataml/data/glass_types.csv +215 -0
- teradataml/data/glm_admissions_model.csv +12 -0
- teradataml/data/glm_example.json +56 -0
- teradataml/data/glml1l2_example.json +28 -0
- teradataml/data/glml1l2predict_example.json +54 -0
- teradataml/data/glmpredict_example.json +54 -0
- teradataml/data/gq_t1.csv +21 -0
- teradataml/data/grocery_transaction.csv +19 -0
- teradataml/data/hconvolve_complex_right.csv +5 -0
- teradataml/data/hconvolve_complex_rightmulti.csv +5 -0
- teradataml/data/histogram_example.json +12 -0
- teradataml/data/hmmdecoder_example.json +79 -0
- teradataml/data/hmmevaluator_example.json +25 -0
- teradataml/data/hmmsupervised_example.json +10 -0
- teradataml/data/hmmunsupervised_example.json +8 -0
- teradataml/data/hnsw_alter_data.csv +5 -0
- teradataml/data/hnsw_data.csv +10 -0
- teradataml/data/house_values.csv +12 -0
- teradataml/data/house_values2.csv +13 -0
- teradataml/data/housing_cat.csv +7 -0
- teradataml/data/housing_data.csv +9 -0
- teradataml/data/housing_test.csv +47 -0
- teradataml/data/housing_test_binary.csv +47 -0
- teradataml/data/housing_train.csv +493 -0
- teradataml/data/housing_train_attribute.csv +5 -0
- teradataml/data/housing_train_binary.csv +437 -0
- teradataml/data/housing_train_parameter.csv +2 -0
- teradataml/data/housing_train_response.csv +493 -0
- teradataml/data/housing_train_segment.csv +201 -0
- teradataml/data/ibm_stock.csv +370 -0
- teradataml/data/ibm_stock1.csv +370 -0
- teradataml/data/identitymatch_example.json +22 -0
- teradataml/data/idf_table.csv +4 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/impressions.csv +101 -0
- teradataml/data/inflation.csv +21 -0
- teradataml/data/initial.csv +3 -0
- teradataml/data/insect2Cols.csv +61 -0
- teradataml/data/insect_sprays.csv +13 -0
- teradataml/data/insurance.csv +1339 -0
- teradataml/data/interpolator_example.json +13 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/iris_altinput.csv +481 -0
- teradataml/data/iris_attribute_output.csv +8 -0
- teradataml/data/iris_attribute_test.csv +121 -0
- teradataml/data/iris_attribute_train.csv +481 -0
- teradataml/data/iris_category_expect_predict.csv +31 -0
- teradataml/data/iris_data.csv +151 -0
- teradataml/data/iris_input.csv +151 -0
- teradataml/data/iris_response_train.csv +121 -0
- teradataml/data/iris_test.csv +31 -0
- teradataml/data/iris_train.csv +121 -0
- teradataml/data/join_table1.csv +4 -0
- teradataml/data/join_table2.csv +4 -0
- teradataml/data/jsons/anly_function_name.json +7 -0
- teradataml/data/jsons/byom/ONNXSeq2Seq.json +287 -0
- teradataml/data/jsons/byom/dataikupredict.json +148 -0
- teradataml/data/jsons/byom/datarobotpredict.json +147 -0
- teradataml/data/jsons/byom/h2opredict.json +195 -0
- teradataml/data/jsons/byom/onnxembeddings.json +267 -0
- teradataml/data/jsons/byom/onnxpredict.json +187 -0
- teradataml/data/jsons/byom/pmmlpredict.json +147 -0
- teradataml/data/jsons/paired_functions.json +450 -0
- teradataml/data/jsons/sqle/16.20/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/16.20/Attribution.json +249 -0
- teradataml/data/jsons/sqle/16.20/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/16.20/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/16.20/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/16.20/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/16.20/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/16.20/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/16.20/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/16.20/Pack.json +98 -0
- teradataml/data/jsons/sqle/16.20/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/16.20/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/16.20/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/16.20/Unpack.json +166 -0
- teradataml/data/jsons/sqle/16.20/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.00/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.00/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.00/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/17.00/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/17.00/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/17.00/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.00/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.00/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/17.00/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/17.00/Pack.json +98 -0
- teradataml/data/jsons/sqle/17.00/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/17.00/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.00/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.00/Unpack.json +166 -0
- teradataml/data/jsons/sqle/17.00/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.05/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.05/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.05/DecisionForestPredict.json +156 -0
- teradataml/data/jsons/sqle/17.05/DecisionTreePredict.json +170 -0
- teradataml/data/jsons/sqle/17.05/GLMPredict.json +122 -0
- teradataml/data/jsons/sqle/17.05/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.05/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.05/NaiveBayesPredict.json +136 -0
- teradataml/data/jsons/sqle/17.05/NaiveBayesTextClassifierPredict.json +235 -0
- teradataml/data/jsons/sqle/17.05/Pack.json +98 -0
- teradataml/data/jsons/sqle/17.05/SVMSparsePredict.json +162 -0
- teradataml/data/jsons/sqle/17.05/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.05/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.05/Unpack.json +166 -0
- teradataml/data/jsons/sqle/17.05/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.10/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.10/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.10/DecisionForestPredict.json +185 -0
- teradataml/data/jsons/sqle/17.10/DecisionTreePredict.json +172 -0
- teradataml/data/jsons/sqle/17.10/GLMPredict.json +151 -0
- teradataml/data/jsons/sqle/17.10/MovingAverage.json +368 -0
- teradataml/data/jsons/sqle/17.10/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.10/NaiveBayesPredict.json +149 -0
- teradataml/data/jsons/sqle/17.10/NaiveBayesTextClassifierPredict.json +288 -0
- teradataml/data/jsons/sqle/17.10/Pack.json +133 -0
- teradataml/data/jsons/sqle/17.10/SVMSparsePredict.json +193 -0
- teradataml/data/jsons/sqle/17.10/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.10/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.10/TD_BinCodeFit.json +239 -0
- teradataml/data/jsons/sqle/17.10/TD_BinCodeTransform.json +70 -0
- teradataml/data/jsons/sqle/17.10/TD_CategoricalSummary.json +54 -0
- teradataml/data/jsons/sqle/17.10/TD_Chisq.json +68 -0
- teradataml/data/jsons/sqle/17.10/TD_ColumnSummary.json +54 -0
- teradataml/data/jsons/sqle/17.10/TD_ConvertTo.json +69 -0
- teradataml/data/jsons/sqle/17.10/TD_FTest.json +187 -0
- teradataml/data/jsons/sqle/17.10/TD_FillRowID.json +52 -0
- teradataml/data/jsons/sqle/17.10/TD_FunctionFit.json +46 -0
- teradataml/data/jsons/sqle/17.10/TD_FunctionTransform.json +72 -0
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithMissingValues.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_GetRowsWithoutMissingValues.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_Histogram.json +133 -0
- teradataml/data/jsons/sqle/17.10/TD_NumApply.json +147 -0
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingFit.json +183 -0
- teradataml/data/jsons/sqle/17.10/TD_OneHotEncodingTransform.json +66 -0
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterFit.json +197 -0
- teradataml/data/jsons/sqle/17.10/TD_OutlierFilterTransform.json +48 -0
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesFit.json +114 -0
- teradataml/data/jsons/sqle/17.10/TD_PolynomialFeaturesTransform.json +72 -0
- teradataml/data/jsons/sqle/17.10/TD_QQNorm.json +112 -0
- teradataml/data/jsons/sqle/17.10/TD_RoundColumns.json +93 -0
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeFit.json +128 -0
- teradataml/data/jsons/sqle/17.10/TD_RowNormalizeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.10/TD_ScaleFit.json +157 -0
- teradataml/data/jsons/sqle/17.10/TD_ScaleTransform.json +71 -0
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeFit.json +148 -0
- teradataml/data/jsons/sqle/17.10/TD_SimpleImputeTransform.json +48 -0
- teradataml/data/jsons/sqle/17.10/TD_StrApply.json +240 -0
- teradataml/data/jsons/sqle/17.10/TD_UnivariateStatistics.json +119 -0
- teradataml/data/jsons/sqle/17.10/TD_WhichMax.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_WhichMin.json +53 -0
- teradataml/data/jsons/sqle/17.10/TD_ZTest.json +171 -0
- teradataml/data/jsons/sqle/17.10/Unpack.json +188 -0
- teradataml/data/jsons/sqle/17.10/nPath.json +269 -0
- teradataml/data/jsons/sqle/17.20/Antiselect.json +56 -0
- teradataml/data/jsons/sqle/17.20/Attribution.json +249 -0
- teradataml/data/jsons/sqle/17.20/DecisionForestPredict.json +185 -0
- teradataml/data/jsons/sqle/17.20/DecisionTreePredict.json +172 -0
- teradataml/data/jsons/sqle/17.20/GLMPredict.json +151 -0
- teradataml/data/jsons/sqle/17.20/MovingAverage.json +367 -0
- teradataml/data/jsons/sqle/17.20/NGramSplitter.json +239 -0
- teradataml/data/jsons/sqle/17.20/NaiveBayesPredict.json +149 -0
- teradataml/data/jsons/sqle/17.20/NaiveBayesTextClassifierPredict.json +287 -0
- teradataml/data/jsons/sqle/17.20/Pack.json +133 -0
- teradataml/data/jsons/sqle/17.20/SVMSparsePredict.json +192 -0
- teradataml/data/jsons/sqle/17.20/Sessionize.json +105 -0
- teradataml/data/jsons/sqle/17.20/StringSimilarity.json +86 -0
- teradataml/data/jsons/sqle/17.20/TD_ANOVA.json +149 -0
- teradataml/data/jsons/sqle/17.20/TD_Apriori.json +181 -0
- teradataml/data/jsons/sqle/17.20/TD_BinCodeFit.json +239 -0
- teradataml/data/jsons/sqle/17.20/TD_BinCodeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- teradataml/data/jsons/sqle/17.20/TD_CategoricalSummary.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_Chisq.json +68 -0
- teradataml/data/jsons/sqle/17.20/TD_ClassificationEvaluator.json +146 -0
- teradataml/data/jsons/sqle/17.20/TD_ColumnSummary.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_ColumnTransformer.json +218 -0
- teradataml/data/jsons/sqle/17.20/TD_ConvertTo.json +92 -0
- teradataml/data/jsons/sqle/17.20/TD_DecisionForest.json +260 -0
- teradataml/data/jsons/sqle/17.20/TD_DecisionForestPredict.json +139 -0
- teradataml/data/jsons/sqle/17.20/TD_FTest.json +269 -0
- teradataml/data/jsons/sqle/17.20/TD_FillRowID.json +52 -0
- teradataml/data/jsons/sqle/17.20/TD_FunctionFit.json +46 -0
- teradataml/data/jsons/sqle/17.20/TD_FunctionTransform.json +72 -0
- teradataml/data/jsons/sqle/17.20/TD_GLM.json +507 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPREDICT.json +168 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPerSegment.json +411 -0
- teradataml/data/jsons/sqle/17.20/TD_GLMPredictPerSegment.json +146 -0
- teradataml/data/jsons/sqle/17.20/TD_GetFutileColumns.json +93 -0
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithMissingValues.json +76 -0
- teradataml/data/jsons/sqle/17.20/TD_GetRowsWithoutMissingValues.json +76 -0
- teradataml/data/jsons/sqle/17.20/TD_Histogram.json +152 -0
- teradataml/data/jsons/sqle/17.20/TD_KMeans.json +232 -0
- teradataml/data/jsons/sqle/17.20/TD_KMeansPredict.json +87 -0
- teradataml/data/jsons/sqle/17.20/TD_KNN.json +262 -0
- teradataml/data/jsons/sqle/17.20/TD_NERExtractor.json +145 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesTextClassifierTrainer.json +137 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineFit.json +102 -0
- teradataml/data/jsons/sqle/17.20/TD_NonLinearCombineTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_NumApply.json +147 -0
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +316 -0
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVMPredict.json +124 -0
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingFit.json +271 -0
- teradataml/data/jsons/sqle/17.20/TD_OneHotEncodingTransform.json +65 -0
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingFit.json +229 -0
- teradataml/data/jsons/sqle/17.20/TD_OrdinalEncodingTransform.json +75 -0
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterFit.json +217 -0
- teradataml/data/jsons/sqle/17.20/TD_OutlierFilterTransform.json +48 -0
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesFit.json +114 -0
- teradataml/data/jsons/sqle/17.20/TD_PolynomialFeaturesTransform.json +72 -0
- teradataml/data/jsons/sqle/17.20/TD_QQNorm.json +111 -0
- teradataml/data/jsons/sqle/17.20/TD_ROC.json +179 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionFit.json +179 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionMinComponents.json +74 -0
- teradataml/data/jsons/sqle/17.20/TD_RandomProjectionTransform.json +74 -0
- teradataml/data/jsons/sqle/17.20/TD_RegressionEvaluator.json +138 -0
- teradataml/data/jsons/sqle/17.20/TD_RoundColumns.json +93 -0
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeFit.json +128 -0
- teradataml/data/jsons/sqle/17.20/TD_RowNormalizeTransform.json +71 -0
- teradataml/data/jsons/sqle/17.20/TD_SMOTE.json +267 -0
- teradataml/data/jsons/sqle/17.20/TD_SVM.json +389 -0
- teradataml/data/jsons/sqle/17.20/TD_SVMPredict.json +142 -0
- teradataml/data/jsons/sqle/17.20/TD_ScaleFit.json +310 -0
- teradataml/data/jsons/sqle/17.20/TD_ScaleTransform.json +120 -0
- teradataml/data/jsons/sqle/17.20/TD_SentimentExtractor.json +194 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +221 -0
- teradataml/data/jsons/sqle/17.20/TD_Silhouette.json +143 -0
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeFit.json +147 -0
- teradataml/data/jsons/sqle/17.20/TD_SimpleImputeTransform.json +48 -0
- teradataml/data/jsons/sqle/17.20/TD_StrApply.json +240 -0
- teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingFit.json +248 -0
- teradataml/data/jsons/sqle/17.20/TD_TargetEncodingTransform.json +75 -0
- teradataml/data/jsons/sqle/17.20/TD_TextMorph.json +134 -0
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +297 -0
- teradataml/data/jsons/sqle/17.20/TD_TrainTestSplit.json +142 -0
- teradataml/data/jsons/sqle/17.20/TD_UnivariateStatistics.json +117 -0
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/17.20/TD_VectorDistance.json +183 -0
- teradataml/data/jsons/sqle/17.20/TD_WhichMax.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_WhichMin.json +53 -0
- teradataml/data/jsons/sqle/17.20/TD_WordEmbeddings.json +241 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoost.json +330 -0
- teradataml/data/jsons/sqle/17.20/TD_XGBoostPredict.json +195 -0
- teradataml/data/jsons/sqle/17.20/TD_ZTest.json +247 -0
- teradataml/data/jsons/sqle/17.20/Unpack.json +188 -0
- teradataml/data/jsons/sqle/17.20/nPath.json +269 -0
- teradataml/data/jsons/sqle/20.00/AI_AnalyzeSentiment.json +370 -0
- teradataml/data/jsons/sqle/20.00/AI_AskLLM.json +460 -0
- teradataml/data/jsons/sqle/20.00/AI_DetectLanguage.json +385 -0
- teradataml/data/jsons/sqle/20.00/AI_ExtractKeyPhrases.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_MaskPII.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizeEntities.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_RecognizePIIEntities.json +369 -0
- teradataml/data/jsons/sqle/20.00/AI_TextClassifier.json +400 -0
- teradataml/data/jsons/sqle/20.00/AI_TextEmbeddings.json +401 -0
- teradataml/data/jsons/sqle/20.00/AI_TextSummarize.json +384 -0
- teradataml/data/jsons/sqle/20.00/AI_TextTranslate.json +384 -0
- teradataml/data/jsons/sqle/20.00/TD_API_AzureML.json +151 -0
- teradataml/data/jsons/sqle/20.00/TD_API_Sagemaker.json +182 -0
- teradataml/data/jsons/sqle/20.00/TD_API_VertexAI.json +183 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSW.json +296 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWPredict.json +206 -0
- teradataml/data/jsons/sqle/20.00/TD_HNSWSummary.json +32 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/tableoperator/17.00/read_nos.json +198 -0
- teradataml/data/jsons/tableoperator/17.05/read_nos.json +198 -0
- teradataml/data/jsons/tableoperator/17.05/write_nos.json +195 -0
- teradataml/data/jsons/tableoperator/17.10/read_nos.json +184 -0
- teradataml/data/jsons/tableoperator/17.10/write_nos.json +195 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
- teradataml/data/jsons/tableoperator/17.20/read_nos.json +183 -0
- teradataml/data/jsons/tableoperator/17.20/write_nos.json +224 -0
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +132 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +396 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +77 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +153 -0
- teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
- teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +107 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +106 -0
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +89 -0
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +104 -0
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +66 -0
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +87 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +134 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +144 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +108 -0
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +108 -0
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_DIFF.json +92 -0
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +114 -0
- teradataml/data/jsons/uaf/17.20/TD_DURBIN_WATSON.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
- teradataml/data/jsons/uaf/17.20/TD_EXTRACT_RESULTS.json +39 -0
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4FORMULA.json +85 -0
- teradataml/data/jsons/uaf/17.20/TD_GENSERIES4SINUSOIDS.json +71 -0
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +139 -0
- teradataml/data/jsons/uaf/17.20/TD_HOLT_WINTERS_FORECASTER.json +313 -0
- teradataml/data/jsons/uaf/17.20/TD_IDFFT.json +58 -0
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +81 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
- teradataml/data/jsons/uaf/17.20/TD_INPUTVALIDATOR.json +64 -0
- teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +182 -0
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +103 -0
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +181 -0
- teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
- teradataml/data/jsons/uaf/17.20/TD_MATRIXMULTIPLY.json +68 -0
- teradataml/data/jsons/uaf/17.20/TD_MINFO.json +67 -0
- teradataml/data/jsons/uaf/17.20/TD_MULTIVAR_REGR.json +179 -0
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +114 -0
- teradataml/data/jsons/uaf/17.20/TD_PORTMAN.json +119 -0
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +175 -0
- teradataml/data/jsons/uaf/17.20/TD_POWERTRANSFORM.json +98 -0
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +194 -0
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +210 -0
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +143 -0
- teradataml/data/jsons/uaf/17.20/TD_SELECTION_CRITERIA.json +90 -0
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_PERIODICITIES.json +80 -0
- teradataml/data/jsons/uaf/17.20/TD_SIGNIF_RESIDMEAN.json +68 -0
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +184 -0
- teradataml/data/jsons/uaf/17.20/TD_SINFO.json +58 -0
- teradataml/data/jsons/uaf/17.20/TD_SMOOTHMA.json +163 -0
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +101 -0
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +112 -0
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +95 -0
- teradataml/data/jsons/uaf/17.20/TD_WHITES_GENERAL.json +78 -0
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +410 -0
- teradataml/data/kmeans_example.json +23 -0
- teradataml/data/kmeans_table.csv +10 -0
- teradataml/data/kmeans_us_arrests_data.csv +51 -0
- teradataml/data/knn_example.json +19 -0
- teradataml/data/knnrecommender_example.json +7 -0
- teradataml/data/knnrecommenderpredict_example.json +12 -0
- teradataml/data/lar_example.json +17 -0
- teradataml/data/larpredict_example.json +30 -0
- teradataml/data/lc_new_predictors.csv +5 -0
- teradataml/data/lc_new_reference.csv +9 -0
- teradataml/data/lda_example.json +9 -0
- teradataml/data/ldainference_example.json +15 -0
- teradataml/data/ldatopicsummary_example.json +9 -0
- teradataml/data/levendist_input.csv +13 -0
- teradataml/data/levenshteindistance_example.json +10 -0
- teradataml/data/linreg_example.json +10 -0
- teradataml/data/load_example_data.py +350 -0
- teradataml/data/loan_prediction.csv +295 -0
- teradataml/data/lungcancer.csv +138 -0
- teradataml/data/mappingdata.csv +12 -0
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/milk_timeseries.csv +157 -0
- teradataml/data/min_max_titanic.csv +4 -0
- teradataml/data/minhash_example.json +6 -0
- teradataml/data/ml_ratings.csv +7547 -0
- teradataml/data/ml_ratings_10.csv +2445 -0
- teradataml/data/mobile_data.csv +13 -0
- teradataml/data/model1_table.csv +5 -0
- teradataml/data/model2_table.csv +5 -0
- teradataml/data/models/License_file.txt +1 -0
- teradataml/data/models/License_file_empty.txt +0 -0
- teradataml/data/models/dataiku_iris_data_ann_thin +0 -0
- teradataml/data/models/dr_iris_rf +0 -0
- teradataml/data/models/iris_db_dt_model_sklearn.onnx +0 -0
- teradataml/data/models/iris_db_dt_model_sklearn_floattensor.onnx +0 -0
- teradataml/data/models/iris_db_glm_model.pmml +57 -0
- teradataml/data/models/iris_db_xgb_model.pmml +4471 -0
- teradataml/data/models/iris_kmeans_model +0 -0
- teradataml/data/models/iris_mojo_glm_h2o_model +0 -0
- teradataml/data/models/iris_mojo_xgb_h2o_model +0 -0
- teradataml/data/modularity_example.json +12 -0
- teradataml/data/movavg_example.json +8 -0
- teradataml/data/mtx1.csv +7 -0
- teradataml/data/mtx2.csv +13 -0
- teradataml/data/multi_model_classification.csv +401 -0
- teradataml/data/multi_model_regression.csv +401 -0
- teradataml/data/mvdfft8.csv +9 -0
- teradataml/data/naivebayes_example.json +10 -0
- teradataml/data/naivebayespredict_example.json +19 -0
- teradataml/data/naivebayestextclassifier2_example.json +7 -0
- teradataml/data/naivebayestextclassifier_example.json +8 -0
- teradataml/data/naivebayestextclassifierpredict_example.json +32 -0
- teradataml/data/name_Find_configure.csv +10 -0
- teradataml/data/namedentityfinder_example.json +14 -0
- teradataml/data/namedentityfinderevaluator_example.json +10 -0
- teradataml/data/namedentityfindertrainer_example.json +6 -0
- teradataml/data/nb_iris_input_test.csv +31 -0
- teradataml/data/nb_iris_input_train.csv +121 -0
- teradataml/data/nbp_iris_model.csv +13 -0
- teradataml/data/ner_dict.csv +8 -0
- teradataml/data/ner_extractor_text.csv +2 -0
- teradataml/data/ner_input_eng.csv +7 -0
- teradataml/data/ner_rule.csv +5 -0
- teradataml/data/ner_sports_test2.csv +29 -0
- teradataml/data/ner_sports_train.csv +501 -0
- teradataml/data/nerevaluator_example.json +6 -0
- teradataml/data/nerextractor_example.json +18 -0
- teradataml/data/nermem_sports_test.csv +18 -0
- teradataml/data/nermem_sports_train.csv +51 -0
- teradataml/data/nertrainer_example.json +7 -0
- teradataml/data/ngrams_example.json +7 -0
- teradataml/data/notebooks/__init__.py +0 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Aggregate Functions using SQLAlchemy.ipynb +1455 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Arithmetic Functions Using SQLAlchemy.ipynb +1993 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Bit-Byte Manipulation Functions using SQLAlchemy.ipynb +1492 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Built-in functions using SQLAlchemy.ipynb +536 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Regular Expressions Using SQLAlchemy.ipynb +570 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage String Functions Using SQLAlchemy.ipynb +2559 -0
- teradataml/data/notebooks/sqlalchemy/Teradata Vantage Window Aggregate Functions using SQLAlchemy.ipynb +2911 -0
- teradataml/data/notebooks/sqlalchemy/Using Generic SQLAlchemy ClauseElements teradataml DataFrame assign method.ipynb +698 -0
- teradataml/data/notebooks/sqlalchemy/__init__.py +0 -0
- teradataml/data/notebooks/sqlalchemy/teradataml filtering using SQLAlchemy ClauseElements.ipynb +784 -0
- teradataml/data/npath_example.json +23 -0
- teradataml/data/ntree_example.json +14 -0
- teradataml/data/numeric_strings.csv +5 -0
- teradataml/data/numerics.csv +4 -0
- teradataml/data/ocean_buoy.csv +17 -0
- teradataml/data/ocean_buoy2.csv +17 -0
- teradataml/data/ocean_buoys.csv +28 -0
- teradataml/data/ocean_buoys2.csv +10 -0
- teradataml/data/ocean_buoys_nonpti.csv +28 -0
- teradataml/data/ocean_buoys_seq.csv +29 -0
- teradataml/data/onehot_encoder_train.csv +4 -0
- teradataml/data/openml_example.json +92 -0
- teradataml/data/optional_event_table.csv +4 -0
- teradataml/data/orders1.csv +11 -0
- teradataml/data/orders1_12.csv +13 -0
- teradataml/data/orders_ex.csv +4 -0
- teradataml/data/pack_example.json +9 -0
- teradataml/data/package_tracking.csv +19 -0
- teradataml/data/package_tracking_pti.csv +19 -0
- teradataml/data/pagerank_example.json +13 -0
- teradataml/data/paragraphs_input.csv +6 -0
- teradataml/data/pathanalyzer_example.json +8 -0
- teradataml/data/pathgenerator_example.json +8 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/pattern_matching_data.csv +11 -0
- teradataml/data/payment_fraud_dataset.csv +10001 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/phrases.csv +7 -0
- teradataml/data/pivot_example.json +9 -0
- teradataml/data/pivot_input.csv +22 -0
- teradataml/data/playerRating.csv +31 -0
- teradataml/data/pos_input.csv +40 -0
- teradataml/data/postagger_example.json +7 -0
- teradataml/data/posttagger_output.csv +44 -0
- teradataml/data/production_data.csv +17 -0
- teradataml/data/production_data2.csv +7 -0
- teradataml/data/randomsample_example.json +32 -0
- teradataml/data/randomwalksample_example.json +9 -0
- teradataml/data/rank_table.csv +6 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/ref_mobile_data.csv +4 -0
- teradataml/data/ref_mobile_data_dense.csv +2 -0
- teradataml/data/ref_url.csv +17 -0
- teradataml/data/restaurant_reviews.csv +7 -0
- teradataml/data/retail_churn_table.csv +27772 -0
- teradataml/data/river_data.csv +145 -0
- teradataml/data/roc_example.json +8 -0
- teradataml/data/roc_input.csv +101 -0
- teradataml/data/rule_inputs.csv +6 -0
- teradataml/data/rule_table.csv +2 -0
- teradataml/data/sales.csv +7 -0
- teradataml/data/sales_transaction.csv +501 -0
- teradataml/data/salesdata.csv +342 -0
- teradataml/data/sample_cities.csv +3 -0
- teradataml/data/sample_shapes.csv +11 -0
- teradataml/data/sample_streets.csv +3 -0
- teradataml/data/sampling_example.json +16 -0
- teradataml/data/sax_example.json +17 -0
- teradataml/data/scale_attributes.csv +3 -0
- teradataml/data/scale_example.json +74 -0
- teradataml/data/scale_housing.csv +11 -0
- teradataml/data/scale_housing_test.csv +6 -0
- teradataml/data/scale_input_part_sparse.csv +31 -0
- teradataml/data/scale_input_partitioned.csv +16 -0
- teradataml/data/scale_input_sparse.csv +11 -0
- teradataml/data/scale_parameters.csv +3 -0
- teradataml/data/scale_stat.csv +11 -0
- teradataml/data/scalebypartition_example.json +13 -0
- teradataml/data/scalemap_example.json +13 -0
- teradataml/data/scalesummary_example.json +12 -0
- teradataml/data/score_category.csv +101 -0
- teradataml/data/score_summary.csv +4 -0
- teradataml/data/script_example.json +10 -0
- teradataml/data/scripts/deploy_script.py +84 -0
- teradataml/data/scripts/lightgbm/dataset.template +175 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +264 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +234 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +177 -0
- teradataml/data/scripts/mapper.R +20 -0
- teradataml/data/scripts/mapper.py +16 -0
- teradataml/data/scripts/mapper_replace.py +16 -0
- teradataml/data/scripts/sklearn/__init__.py +0 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +205 -0
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +148 -0
- teradataml/data/scripts/sklearn/sklearn_function.template +144 -0
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +166 -0
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +161 -0
- teradataml/data/scripts/sklearn/sklearn_score.py +145 -0
- teradataml/data/scripts/sklearn/sklearn_transform.py +327 -0
- teradataml/data/sdk/modelops/modelops_spec.json +101737 -0
- teradataml/data/seeds.csv +10 -0
- teradataml/data/sentenceextractor_example.json +7 -0
- teradataml/data/sentiment_extract_input.csv +11 -0
- teradataml/data/sentiment_train.csv +16 -0
- teradataml/data/sentiment_word.csv +20 -0
- teradataml/data/sentiment_word_input.csv +20 -0
- teradataml/data/sentimentextractor_example.json +24 -0
- teradataml/data/sentimenttrainer_example.json +8 -0
- teradataml/data/sequence_table.csv +10 -0
- teradataml/data/seriessplitter_example.json +8 -0
- teradataml/data/sessionize_example.json +17 -0
- teradataml/data/sessionize_table.csv +116 -0
- teradataml/data/setop_test1.csv +24 -0
- teradataml/data/setop_test2.csv +22 -0
- teradataml/data/soc_nw_edges.csv +11 -0
- teradataml/data/soc_nw_vertices.csv +8 -0
- teradataml/data/souvenir_timeseries.csv +168 -0
- teradataml/data/sparse_iris_attribute.csv +5 -0
- teradataml/data/sparse_iris_test.csv +121 -0
- teradataml/data/sparse_iris_train.csv +601 -0
- teradataml/data/star1.csv +6 -0
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/state_transition.csv +5 -0
- teradataml/data/stock_data.csv +53 -0
- teradataml/data/stock_movement.csv +11 -0
- teradataml/data/stock_vol.csv +76 -0
- teradataml/data/stop_words.csv +8 -0
- teradataml/data/store_sales.csv +37 -0
- teradataml/data/stringsimilarity_example.json +8 -0
- teradataml/data/strsimilarity_input.csv +13 -0
- teradataml/data/students.csv +101 -0
- teradataml/data/svm_iris_input_test.csv +121 -0
- teradataml/data/svm_iris_input_train.csv +481 -0
- teradataml/data/svm_iris_model.csv +7 -0
- teradataml/data/svmdense_example.json +10 -0
- teradataml/data/svmdensepredict_example.json +19 -0
- teradataml/data/svmsparse_example.json +8 -0
- teradataml/data/svmsparsepredict_example.json +14 -0
- teradataml/data/svmsparsesummary_example.json +8 -0
- teradataml/data/target_mobile_data.csv +13 -0
- teradataml/data/target_mobile_data_dense.csv +5 -0
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/tdnerextractor_example.json +14 -0
- teradataml/data/templatedata.csv +1201 -0
- teradataml/data/templates/open_source_ml.json +11 -0
- teradataml/data/teradata_icon.ico +0 -0
- teradataml/data/teradataml_example.json +1473 -0
- teradataml/data/test_classification.csv +101 -0
- teradataml/data/test_loan_prediction.csv +53 -0
- teradataml/data/test_pacf_12.csv +37 -0
- teradataml/data/test_prediction.csv +101 -0
- teradataml/data/test_regression.csv +101 -0
- teradataml/data/test_river2.csv +109 -0
- teradataml/data/text_inputs.csv +6 -0
- teradataml/data/textchunker_example.json +8 -0
- teradataml/data/textclassifier_example.json +7 -0
- teradataml/data/textclassifier_input.csv +7 -0
- teradataml/data/textclassifiertrainer_example.json +7 -0
- teradataml/data/textmorph_example.json +11 -0
- teradataml/data/textparser_example.json +15 -0
- teradataml/data/texttagger_example.json +12 -0
- teradataml/data/texttokenizer_example.json +7 -0
- teradataml/data/texttrainer_input.csv +11 -0
- teradataml/data/tf_example.json +7 -0
- teradataml/data/tfidf_example.json +14 -0
- teradataml/data/tfidf_input1.csv +201 -0
- teradataml/data/tfidf_train.csv +6 -0
- teradataml/data/time_table1.csv +535 -0
- teradataml/data/time_table2.csv +14 -0
- teradataml/data/timeseriesdata.csv +1601 -0
- teradataml/data/timeseriesdatasetsd4.csv +105 -0
- teradataml/data/timestamp_data.csv +4 -0
- teradataml/data/titanic.csv +892 -0
- teradataml/data/titanic_dataset_unpivoted.csv +19 -0
- teradataml/data/to_num_data.csv +4 -0
- teradataml/data/tochar_data.csv +5 -0
- teradataml/data/token_table.csv +696 -0
- teradataml/data/train_multiclass.csv +101 -0
- teradataml/data/train_regression.csv +101 -0
- teradataml/data/train_regression_multiple_labels.csv +101 -0
- teradataml/data/train_tracking.csv +28 -0
- teradataml/data/trans_dense.csv +16 -0
- teradataml/data/trans_sparse.csv +55 -0
- teradataml/data/transformation_table.csv +6 -0
- teradataml/data/transformation_table_new.csv +2 -0
- teradataml/data/tv_spots.csv +16 -0
- teradataml/data/twod_climate_data.csv +117 -0
- teradataml/data/uaf_example.json +529 -0
- teradataml/data/univariatestatistics_example.json +9 -0
- teradataml/data/unpack_example.json +10 -0
- teradataml/data/unpivot_example.json +25 -0
- teradataml/data/unpivot_input.csv +8 -0
- teradataml/data/url_data.csv +10 -0
- teradataml/data/us_air_pass.csv +37 -0
- teradataml/data/us_population.csv +624 -0
- teradataml/data/us_states_shapes.csv +52 -0
- teradataml/data/varmax_example.json +18 -0
- teradataml/data/vectordistance_example.json +30 -0
- teradataml/data/ville_climatedata.csv +121 -0
- teradataml/data/ville_tempdata.csv +12 -0
- teradataml/data/ville_tempdata1.csv +12 -0
- teradataml/data/ville_temperature.csv +11 -0
- teradataml/data/waveletTable.csv +1605 -0
- teradataml/data/waveletTable2.csv +1605 -0
- teradataml/data/weightedmovavg_example.json +9 -0
- teradataml/data/wft_testing.csv +5 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/data/wine_data.csv +1600 -0
- teradataml/data/word_embed_input_table1.csv +6 -0
- teradataml/data/word_embed_input_table2.csv +5 -0
- teradataml/data/word_embed_model.csv +23 -0
- teradataml/data/words_input.csv +13 -0
- teradataml/data/xconvolve_complex_left.csv +6 -0
- teradataml/data/xconvolve_complex_leftmulti.csv +6 -0
- teradataml/data/xgboost_example.json +36 -0
- teradataml/data/xgboostpredict_example.json +32 -0
- teradataml/data/ztest_example.json +16 -0
- teradataml/dataframe/__init__.py +0 -0
- teradataml/dataframe/copy_to.py +2446 -0
- teradataml/dataframe/data_transfer.py +2840 -0
- teradataml/dataframe/dataframe.py +20908 -0
- teradataml/dataframe/dataframe_utils.py +2114 -0
- teradataml/dataframe/fastload.py +794 -0
- teradataml/dataframe/functions.py +2110 -0
- teradataml/dataframe/indexer.py +424 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +1171 -0
- teradataml/dataframe/sql.py +10904 -0
- teradataml/dataframe/sql_function_parameters.py +440 -0
- teradataml/dataframe/sql_functions.py +652 -0
- teradataml/dataframe/sql_interfaces.py +220 -0
- teradataml/dataframe/vantage_function_types.py +675 -0
- teradataml/dataframe/window.py +694 -0
- teradataml/dbutils/__init__.py +3 -0
- teradataml/dbutils/dbutils.py +2871 -0
- teradataml/dbutils/filemgr.py +318 -0
- teradataml/gen_ai/__init__.py +2 -0
- teradataml/gen_ai/convAI.py +473 -0
- teradataml/geospatial/__init__.py +4 -0
- teradataml/geospatial/geodataframe.py +1105 -0
- teradataml/geospatial/geodataframecolumn.py +392 -0
- teradataml/geospatial/geometry_types.py +926 -0
- teradataml/hyperparameter_tuner/__init__.py +1 -0
- teradataml/hyperparameter_tuner/optimizer.py +4115 -0
- teradataml/hyperparameter_tuner/utils.py +303 -0
- teradataml/lib/__init__.py +0 -0
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/lib/libaed_0_1.dylib +0 -0
- teradataml/lib/libaed_0_1.so +0 -0
- teradataml/lib/libaed_0_1_aarch64.so +0 -0
- teradataml/lib/libaed_0_1_ppc64le.so +0 -0
- teradataml/opensource/__init__.py +1 -0
- teradataml/opensource/_base.py +1321 -0
- teradataml/opensource/_class.py +464 -0
- teradataml/opensource/_constants.py +61 -0
- teradataml/opensource/_lightgbm.py +949 -0
- teradataml/opensource/_sklearn.py +1008 -0
- teradataml/opensource/_wrapper_utils.py +267 -0
- teradataml/options/__init__.py +148 -0
- teradataml/options/configure.py +489 -0
- teradataml/options/display.py +187 -0
- teradataml/plot/__init__.py +3 -0
- teradataml/plot/axis.py +1427 -0
- teradataml/plot/constants.py +15 -0
- teradataml/plot/figure.py +431 -0
- teradataml/plot/plot.py +810 -0
- teradataml/plot/query_generator.py +83 -0
- teradataml/plot/subplot.py +216 -0
- teradataml/scriptmgmt/UserEnv.py +4273 -0
- teradataml/scriptmgmt/__init__.py +3 -0
- teradataml/scriptmgmt/lls_utils.py +2157 -0
- teradataml/sdk/README.md +79 -0
- teradataml/sdk/__init__.py +4 -0
- teradataml/sdk/_auth_modes.py +422 -0
- teradataml/sdk/_func_params.py +487 -0
- teradataml/sdk/_json_parser.py +453 -0
- teradataml/sdk/_openapi_spec_constants.py +249 -0
- teradataml/sdk/_utils.py +236 -0
- teradataml/sdk/api_client.py +900 -0
- teradataml/sdk/constants.py +62 -0
- teradataml/sdk/modelops/__init__.py +98 -0
- teradataml/sdk/modelops/_client.py +409 -0
- teradataml/sdk/modelops/_constants.py +304 -0
- teradataml/sdk/modelops/models.py +2308 -0
- teradataml/sdk/spinner.py +107 -0
- teradataml/series/__init__.py +0 -0
- teradataml/series/series.py +537 -0
- teradataml/series/series_utils.py +71 -0
- teradataml/store/__init__.py +12 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +658 -0
- teradataml/store/feature_store/feature_store.py +4814 -0
- teradataml/store/feature_store/mind_map.py +639 -0
- teradataml/store/feature_store/models.py +7330 -0
- teradataml/store/feature_store/utils.py +390 -0
- teradataml/table_operators/Apply.py +979 -0
- teradataml/table_operators/Script.py +1739 -0
- teradataml/table_operators/TableOperator.py +1343 -0
- teradataml/table_operators/__init__.py +2 -0
- teradataml/table_operators/apply_query_generator.py +262 -0
- teradataml/table_operators/query_generator.py +493 -0
- teradataml/table_operators/table_operator_query_generator.py +462 -0
- teradataml/table_operators/table_operator_util.py +726 -0
- teradataml/table_operators/templates/dataframe_apply.template +184 -0
- teradataml/table_operators/templates/dataframe_map.template +176 -0
- teradataml/table_operators/templates/dataframe_register.template +73 -0
- teradataml/table_operators/templates/dataframe_udf.template +67 -0
- teradataml/table_operators/templates/script_executor.template +170 -0
- teradataml/telemetry_utils/__init__.py +0 -0
- teradataml/telemetry_utils/queryband.py +53 -0
- teradataml/utils/__init__.py +0 -0
- teradataml/utils/docstring.py +527 -0
- teradataml/utils/dtypes.py +943 -0
- teradataml/utils/internal_buffer.py +122 -0
- teradataml/utils/print_versions.py +206 -0
- teradataml/utils/utils.py +451 -0
- teradataml/utils/validators.py +3305 -0
- teradataml-20.0.0.8.dist-info/METADATA +2804 -0
- teradataml-20.0.0.8.dist-info/RECORD +1208 -0
- teradataml-20.0.0.8.dist-info/WHEEL +5 -0
- teradataml-20.0.0.8.dist-info/top_level.txt +1 -0
- teradataml-20.0.0.8.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,2110 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from inspect import getsource
|
|
3
|
+
import re
|
|
4
|
+
from teradataml.dataframe.copy_to import copy_to_sql
|
|
5
|
+
from teradataml.dataframe.dataframe import DataFrame
|
|
6
|
+
from teradataml.dbutils.filemgr import install_file, list_files, remove_file
|
|
7
|
+
from teradataml.utils.utils import execute_sql
|
|
8
|
+
import teradatasqlalchemy as tdsqlalchemy
|
|
9
|
+
from teradataml.utils.validators import _Validators
|
|
10
|
+
from teradataml.dataframe.sql import _SQLColumnExpression
|
|
11
|
+
from teradatasqlalchemy import VARCHAR, CLOB, CHAR, DATE, TIMESTAMP
|
|
12
|
+
from teradataml.common.constants import TableOperatorConstants, TeradataConstants, TeradataTypes
|
|
13
|
+
from teradataml.common.utils import UtilFuncs
|
|
14
|
+
from teradataml.dataframe.sql_interfaces import ColumnExpression
|
|
15
|
+
from teradataml.table_operators.table_operator_util import _TableOperatorUtils
|
|
16
|
+
from teradataml.common.exceptions import TeradataMlException
|
|
17
|
+
from teradataml.common.messages import Messages
|
|
18
|
+
from teradataml.common.messagecodes import MessageCodes
|
|
19
|
+
from teradataml.scriptmgmt.lls_utils import get_env
|
|
20
|
+
from sqlalchemy import literal_column
|
|
21
|
+
|
|
22
|
+
def udf(user_function=None, returns=VARCHAR(1024), env_name = None, delimiter=',', quotechar=None, debug=False):
|
|
23
|
+
"""
|
|
24
|
+
DESCRIPTION:
|
|
25
|
+
Creates a user defined function (UDF).
|
|
26
|
+
|
|
27
|
+
Notes:
|
|
28
|
+
1. Date and time data types must be formatted to supported formats.
|
|
29
|
+
(See Prerequisite Input and Output Structures in Open Analytics Framework for more details.)
|
|
30
|
+
2. Packages required to run the user defined function must be installed in remote user
|
|
31
|
+
environment using install_lib method of UserEnv class. Import statements of these
|
|
32
|
+
packages should be inside the user defined function itself.
|
|
33
|
+
3. Do not call a regular function defined outside the udf() from the user defined function.
|
|
34
|
+
The function definition and call must be inside the udf(). Look at Example 9 to understand more.
|
|
35
|
+
4. One can use the `td_buffer` to cache the data in the user defined function.
|
|
36
|
+
Look at Example 10 to understand more.
|
|
37
|
+
|
|
38
|
+
PARAMETERS:
|
|
39
|
+
user_function:
|
|
40
|
+
Required Argument.
|
|
41
|
+
Specifies the user defined function to create a column for
|
|
42
|
+
teradataml DataFrame.
|
|
43
|
+
Types: function
|
|
44
|
+
Note:
|
|
45
|
+
Lambda functions are not supported. Re-write the lambda function as regular Python function to use with UDF.
|
|
46
|
+
|
|
47
|
+
returns:
|
|
48
|
+
Optional Argument.
|
|
49
|
+
Specifies the output column type.
|
|
50
|
+
Types: teradatasqlalchemy types object
|
|
51
|
+
Default: VARCHAR(1024)
|
|
52
|
+
|
|
53
|
+
env_name:
|
|
54
|
+
Optional Argument.
|
|
55
|
+
Specifies the name of the remote user environment or an object of
|
|
56
|
+
class UserEnv for VantageCloud Lake.
|
|
57
|
+
Types: str or oject of class UserEnv.
|
|
58
|
+
Note:
|
|
59
|
+
* One can set up a user environment with required packages using teradataml
|
|
60
|
+
Open Analytics APIs. If no ``env_name`` is provided, udf use the default
|
|
61
|
+
``openml_env`` user environment. This default environment has latest Python
|
|
62
|
+
and scikit-learn versions that are supported by Open Analytics Framework
|
|
63
|
+
at the time of creating environment.
|
|
64
|
+
|
|
65
|
+
delimiter:
|
|
66
|
+
Optional Argument.
|
|
67
|
+
Specifies a delimiter to use when reading columns from a row and
|
|
68
|
+
writing result columns.
|
|
69
|
+
Default value: ','
|
|
70
|
+
Types: str with one character
|
|
71
|
+
Notes:
|
|
72
|
+
* This argument cannot be same as "quotechar" argument.
|
|
73
|
+
* This argument cannot be a newline character.
|
|
74
|
+
* Use a different delimiter if categorial columns in the data contains
|
|
75
|
+
a character same as the delimiter.
|
|
76
|
+
|
|
77
|
+
quotechar:
|
|
78
|
+
Optional Argument.
|
|
79
|
+
Specifies a character that forces input of the user function
|
|
80
|
+
to be quoted using this specified character.
|
|
81
|
+
Using this argument enables the Advanced SQL Engine to
|
|
82
|
+
distinguish between NULL fields and empty strings.
|
|
83
|
+
A string with length zero is quoted, while NULL fields are not.
|
|
84
|
+
Default value: None
|
|
85
|
+
Types: str with one character
|
|
86
|
+
Notes:
|
|
87
|
+
* This argument cannot be same as "delimiter" argument.
|
|
88
|
+
* This argument cannot be a newline character.
|
|
89
|
+
|
|
90
|
+
debug:
|
|
91
|
+
Optional Argument.
|
|
92
|
+
Specifies whether to display the script file path generated during function execution or not. This
|
|
93
|
+
argument helps in debugging when there are any failures during function execution. When set
|
|
94
|
+
to True, function displays the path of the script and does not remove the file from local file system.
|
|
95
|
+
Otherwise, file is removed from the local file system.
|
|
96
|
+
Default Value: False
|
|
97
|
+
Types: bool
|
|
98
|
+
|
|
99
|
+
RETURNS:
|
|
100
|
+
ColumnExpression
|
|
101
|
+
|
|
102
|
+
RAISES:
|
|
103
|
+
TeradataMLException
|
|
104
|
+
|
|
105
|
+
EXAMPLES:
|
|
106
|
+
# Load the data to run the example.
|
|
107
|
+
>>> load_example_data("dataframe", "sales")
|
|
108
|
+
|
|
109
|
+
# Create a DataFrame on 'sales' table.
|
|
110
|
+
>>> df = DataFrame("sales")
|
|
111
|
+
>>> df
|
|
112
|
+
Feb Jan Mar Apr datetime
|
|
113
|
+
accounts
|
|
114
|
+
Yellow Inc 90.0 NaN NaN NaN 04/01/2017
|
|
115
|
+
Jones LLC 200.0 150.0 140.0 180.0 04/01/2017
|
|
116
|
+
Red Inc 200.0 150.0 140.0 NaN 04/01/2017
|
|
117
|
+
Alpha Co 210.0 200.0 215.0 250.0 04/01/2017
|
|
118
|
+
Blue Inc 90.0 50.0 95.0 101.0 04/01/2017
|
|
119
|
+
Orange Inc 210.0 NaN NaN 250.0 04/01/2017
|
|
120
|
+
|
|
121
|
+
# Example 1: Create the user defined function to get the values in 'accounts'
|
|
122
|
+
# to upper case without passing returns argument.
|
|
123
|
+
>>> from teradataml.dataframe.functions import udf
|
|
124
|
+
>>> @udf
|
|
125
|
+
... def to_upper(s):
|
|
126
|
+
... if s is not None:
|
|
127
|
+
... return s.upper()
|
|
128
|
+
>>>
|
|
129
|
+
# Assign the Column Expression returned by user defined function
|
|
130
|
+
# to the DataFrame.
|
|
131
|
+
>>> res = df.assign(upper_stats = to_upper('accounts'))
|
|
132
|
+
>>> res
|
|
133
|
+
Feb Jan Mar Apr datetime upper_stats
|
|
134
|
+
accounts
|
|
135
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 ALPHA CO
|
|
136
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 BLUE INC
|
|
137
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 YELLOW INC
|
|
138
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 JONES LLC
|
|
139
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 ORANGE INC
|
|
140
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 RED INC
|
|
141
|
+
>>>
|
|
142
|
+
|
|
143
|
+
# Example 2: Create a user defined function to add length of string values in column
|
|
144
|
+
# 'accounts' with column 'Feb' and store the result in Integer type column.
|
|
145
|
+
>>> from teradatasqlalchemy.types import INTEGER
|
|
146
|
+
>>> @udf(returns=INTEGER())
|
|
147
|
+
... def sum(x, y):
|
|
148
|
+
... return len(x)+y
|
|
149
|
+
>>>
|
|
150
|
+
# Assign the Column Expression returned by user defined function
|
|
151
|
+
# to the DataFrame.
|
|
152
|
+
>>> res = df.assign(len_sum = sum('accounts', 'Feb'))
|
|
153
|
+
>>> res
|
|
154
|
+
Feb Jan Mar Apr datetime len_sum
|
|
155
|
+
accounts
|
|
156
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 218
|
|
157
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 98
|
|
158
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 100
|
|
159
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 209
|
|
160
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 220
|
|
161
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 207
|
|
162
|
+
>>>
|
|
163
|
+
|
|
164
|
+
# Example 3: Create a function to get the values in 'accounts' to upper case
|
|
165
|
+
# and pass it to udf as parameter to create a user defined function.
|
|
166
|
+
>>> from teradataml.dataframe.functions import udf
|
|
167
|
+
>>> def to_upper(s):
|
|
168
|
+
... if s is not None:
|
|
169
|
+
... return s.upper()
|
|
170
|
+
>>> upper_case = udf(to_upper)
|
|
171
|
+
>>>
|
|
172
|
+
# Assign the Column Expression returned by user defined function
|
|
173
|
+
# to the DataFrame.
|
|
174
|
+
>>> res = df.assign(upper_stats = upper_case('accounts'))
|
|
175
|
+
>>> res
|
|
176
|
+
Feb Jan Mar Apr datetime upper_stats
|
|
177
|
+
accounts
|
|
178
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 ALPHA CO
|
|
179
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 BLUE INC
|
|
180
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 YELLOW INC
|
|
181
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 JONES LLC
|
|
182
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 ORANGE INC
|
|
183
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 RED INC
|
|
184
|
+
>>>
|
|
185
|
+
|
|
186
|
+
# Example 4: Create a user defined function to add 4 to the 'datetime' column
|
|
187
|
+
# and store the result in DATE type column.
|
|
188
|
+
>>> from teradatasqlalchemy.types import DATE
|
|
189
|
+
>>> import datetime
|
|
190
|
+
>>> @udf(returns=DATE())
|
|
191
|
+
... def add_date(x, y):
|
|
192
|
+
... return (datetime.datetime.strptime(x, "%y/%m/%d")+datetime.timedelta(y)).strftime("%y/%m/%d")
|
|
193
|
+
>>>
|
|
194
|
+
# Assign the Column Expression returned by user defined function
|
|
195
|
+
# to the DataFrame.
|
|
196
|
+
>>> res = df.assign(new_date = add_date('datetime', 4))
|
|
197
|
+
>>> res
|
|
198
|
+
Feb Jan Mar Apr datetime new_date
|
|
199
|
+
accounts
|
|
200
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 17/01/08
|
|
201
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 17/01/08
|
|
202
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 17/01/08
|
|
203
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 17/01/08
|
|
204
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 17/01/08
|
|
205
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 17/01/08
|
|
206
|
+
|
|
207
|
+
# Example 5: Create a user defined function to add 4 to the 'datetime' column
|
|
208
|
+
# without passing returns argument.
|
|
209
|
+
>>> from teradatasqlalchemy.types import DATE
|
|
210
|
+
>>> import datetime
|
|
211
|
+
>>> @udf
|
|
212
|
+
... def add_date(x, y):
|
|
213
|
+
... return (datetime.datetime.strptime(x, "%y/%m/%d")+datetime.timedelta(y))
|
|
214
|
+
>>>
|
|
215
|
+
# Assign the Column Expression returned by user defined function
|
|
216
|
+
# to the DataFrame.
|
|
217
|
+
>>> res = df.assign(new_date = add_date('datetime', 4))
|
|
218
|
+
>>> res
|
|
219
|
+
Feb Jan Mar Apr datetime new_date
|
|
220
|
+
accounts
|
|
221
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 2017-01-08 00:00:00
|
|
222
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 2017-01-08 00:00:00
|
|
223
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 2017-01-08 00:00:00
|
|
224
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 2017-01-08 00:00:00
|
|
225
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 2017-01-08 00:00:00
|
|
226
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 2017-01-08 00:00:00
|
|
227
|
+
|
|
228
|
+
# Example 6: Create a two user defined function to 'to_upper' and 'sum',
|
|
229
|
+
# 'to_upper' to get the values in 'accounts' to upper case and
|
|
230
|
+
# 'sum' to add length of string values in column 'accounts'
|
|
231
|
+
# with column 'Feb' and store the result in Integer type column.
|
|
232
|
+
>>> @udf
|
|
233
|
+
... def to_upper(s):
|
|
234
|
+
... if s is not None:
|
|
235
|
+
... return s.upper()
|
|
236
|
+
>>>
|
|
237
|
+
>>> from teradatasqlalchemy.types import INTEGER
|
|
238
|
+
>>> @udf(returns=INTEGER())
|
|
239
|
+
... def sum(x, y):
|
|
240
|
+
... return len(x)+y
|
|
241
|
+
>>>
|
|
242
|
+
# Assign the both Column Expression returned by user defined functions
|
|
243
|
+
# to the DataFrame.
|
|
244
|
+
>>> res = df.assign(upper_stats = to_upper('accounts'), len_sum = sum('accounts', 'Feb'))
|
|
245
|
+
>>> res
|
|
246
|
+
Feb Jan Mar Apr datetime upper_stats len_sum
|
|
247
|
+
accounts
|
|
248
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 BLUE INC 98
|
|
249
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 RED INC 207
|
|
250
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 YELLOW INC 100
|
|
251
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 JONES LLC 209
|
|
252
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 ORANGE INC 220
|
|
253
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 ALPHA CO 218
|
|
254
|
+
>>>
|
|
255
|
+
|
|
256
|
+
# Example 7: Convert the values is 'accounts' column to upper case using a user
|
|
257
|
+
# defined function on Vantage Cloud Lake.
|
|
258
|
+
# Create a Python 3.10.5 environment with given name and description in Vantage.
|
|
259
|
+
>>> env = create_env('test_udf', 'python_3.10.5', 'Test environment for UDF')
|
|
260
|
+
User environment 'test_udf' created.
|
|
261
|
+
>>>
|
|
262
|
+
# Create a user defined functions to 'to_upper' to get the values in upper case
|
|
263
|
+
# and pass the user env to run it on.
|
|
264
|
+
>>> from teradataml.dataframe.functions import udf
|
|
265
|
+
>>> @udf(env_name = env)
|
|
266
|
+
... def to_upper(s):
|
|
267
|
+
... if s is not None:
|
|
268
|
+
... return s.upper()
|
|
269
|
+
>>>
|
|
270
|
+
# Assign the Column Expression returned by user defined function
|
|
271
|
+
# to the DataFrame.
|
|
272
|
+
>>> df.assign(upper_stats = to_upper('accounts'))
|
|
273
|
+
Feb Jan Mar Apr datetime upper_stats
|
|
274
|
+
accounts
|
|
275
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 ALPHA CO
|
|
276
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 BLUE INC
|
|
277
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 YELLOW INC
|
|
278
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 JONES LLC
|
|
279
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 ORANGE INC
|
|
280
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 RED INC
|
|
281
|
+
|
|
282
|
+
# Example 8: Create a user defined function to add 4 to the 'datetime' column
|
|
283
|
+
# and store the result in DATE type column on Vantage Cloud Lake.
|
|
284
|
+
>>> from teradatasqlalchemy.types import DATE
|
|
285
|
+
>>> import datetime
|
|
286
|
+
>>> @udf(returns=DATE())
|
|
287
|
+
... def add_date(x, y):
|
|
288
|
+
... return (datetime.datetime.strptime(x, "%Y-%m-%d")+datetime.timedelta(y)).strftime("%Y-%m-%d")
|
|
289
|
+
>>>
|
|
290
|
+
# Assign the Column Expression returned by user defined function
|
|
291
|
+
# to the DataFrame.
|
|
292
|
+
>>> res = df.assign(new_date = add_date('datetime', 4))
|
|
293
|
+
>>> res
|
|
294
|
+
Feb Jan Mar Apr datetime new_date
|
|
295
|
+
accounts
|
|
296
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 17/01/08
|
|
297
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 17/01/08
|
|
298
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 17/01/08
|
|
299
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 17/01/08
|
|
300
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 17/01/08
|
|
301
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 17/01/08
|
|
302
|
+
>>>
|
|
303
|
+
|
|
304
|
+
# Example 9: Define a function 'inner_add_date' inside the udf to create a
|
|
305
|
+
# date object by passing year, month, and day and add 1 to that date.
|
|
306
|
+
# Call this function inside the user defined function.
|
|
307
|
+
>>> @udf
|
|
308
|
+
... def add_date(y,m,d):
|
|
309
|
+
... import datetime
|
|
310
|
+
... def inner_add_date(y,m,d):
|
|
311
|
+
... return datetime.date(y,m,d) + datetime.timedelta(1)
|
|
312
|
+
... return inner_add_date(y,m,d)
|
|
313
|
+
|
|
314
|
+
# Assign the Column Expression returned by user defined function
|
|
315
|
+
# to the DataFrame.
|
|
316
|
+
>>> res = df.assign(new_date = add_date(2021, 10, 5))
|
|
317
|
+
>>> res
|
|
318
|
+
Feb Jan Mar Apr datetime new_date
|
|
319
|
+
accounts
|
|
320
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 2021-10-06
|
|
321
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 2021-10-06
|
|
322
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 2021-10-06
|
|
323
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 2021-10-06
|
|
324
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 2021-10-06
|
|
325
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 2021-10-06
|
|
326
|
+
>>>
|
|
327
|
+
|
|
328
|
+
# Example 10: Define a user defined function 'sentiment_analysis' to perform
|
|
329
|
+
# sentiment analysis on the 'review' column using VADER.
|
|
330
|
+
# Note - Cache the model in UDF using 'td_buffer' to avoid loading
|
|
331
|
+
# the model every time the UDF is called.
|
|
332
|
+
|
|
333
|
+
# Load the data to run the example.
|
|
334
|
+
>>> from teradataml import *
|
|
335
|
+
>>> load_example_data("sentimentextractor", "sentiment_extract_input")
|
|
336
|
+
>>> df = DataFrame("sentiment_extract_input")
|
|
337
|
+
|
|
338
|
+
# Create the environment and install the required library.
|
|
339
|
+
>>> env = create_env('text_analysis', 'python_3.10', 'Test environment for UDF')
|
|
340
|
+
>>> env.install_lib('vaderSentiment')
|
|
341
|
+
|
|
342
|
+
# Create a user defined function to perform sentiment analysis.
|
|
343
|
+
>>> from teradatasqlalchemy.types import VARCHAR
|
|
344
|
+
>>> @udf(env_name = env, returns = VARCHAR(80), delimiter='|')
|
|
345
|
+
... def sentiment_analysis(txt):
|
|
346
|
+
... if 'vader_model' not in td_buffer:
|
|
347
|
+
... from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
|
348
|
+
... td_buffer['vader_model'] = SentimentIntensityAnalyzer()
|
|
349
|
+
... sid_obj = td_buffer['vader_model']
|
|
350
|
+
...
|
|
351
|
+
... sentiment_dict = sid_obj.polarity_scores(txt)
|
|
352
|
+
... if sentiment_dict['compound'] >= 0.05 :
|
|
353
|
+
... sentiment = "Positive"
|
|
354
|
+
... elif sentiment_dict['compound'] <= - 0.05 :
|
|
355
|
+
... sentiment = "Negative"
|
|
356
|
+
... else :
|
|
357
|
+
... sentiment = "Neutral"
|
|
358
|
+
... return sentiment
|
|
359
|
+
|
|
360
|
+
# Assign the Column Expression returned by user defined function
|
|
361
|
+
# to the DataFrame.
|
|
362
|
+
>>> res = df.assign(sentiment = sentiment_analysis('review'))
|
|
363
|
+
>>> res = res.select(["id", "product", "sentiment"])
|
|
364
|
+
>>> res
|
|
365
|
+
id product sentiment
|
|
366
|
+
0 5 gps Positive
|
|
367
|
+
1 9 television Negative
|
|
368
|
+
2 8 camera Negative
|
|
369
|
+
3 10 camera Negative
|
|
370
|
+
4 1 camera Positive
|
|
371
|
+
5 4 gps Positive
|
|
372
|
+
6 2 office suite Positive
|
|
373
|
+
7 7 gps Negative
|
|
374
|
+
8 6 gps Negative
|
|
375
|
+
9 3 camera Positive
|
|
376
|
+
>>>
|
|
377
|
+
"""
|
|
378
|
+
|
|
379
|
+
allowed_datatypes = TeradataTypes.TD_ALL_TYPES.value
|
|
380
|
+
# Validate datatypes in returns.
|
|
381
|
+
_Validators._validate_function_arguments([["returns", returns, False, allowed_datatypes]])
|
|
382
|
+
|
|
383
|
+
# Notation: @udf(returnType=INTEGER())
|
|
384
|
+
if user_function is None:
|
|
385
|
+
def wrapper(f):
|
|
386
|
+
def func_(*args):
|
|
387
|
+
return _SQLColumnExpression(expression=None, udf=f, udf_type=returns, udf_args=args,\
|
|
388
|
+
env_name=env_name, delimiter=delimiter, quotechar=quotechar, debug=debug)
|
|
389
|
+
return func_
|
|
390
|
+
return wrapper
|
|
391
|
+
# Notation: @udf
|
|
392
|
+
else:
|
|
393
|
+
def func_(*args):
|
|
394
|
+
return _SQLColumnExpression(expression=None, udf=user_function, udf_type=returns, udf_args=args,\
|
|
395
|
+
env_name=env_name, delimiter=delimiter, quotechar=quotechar, debug=debug)
|
|
396
|
+
return func_
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def register(name, user_function, returns=VARCHAR(1024)):
|
|
400
|
+
"""
|
|
401
|
+
DESCRIPTION:
|
|
402
|
+
Registers a user defined function (UDF).
|
|
403
|
+
|
|
404
|
+
Notes:
|
|
405
|
+
1. Date and time data types must be formatted to supported formats.
|
|
406
|
+
(See Requisite Input and Output Structures in Open Analytics Framework for more details.)
|
|
407
|
+
2. On VantageCloud Lake, user defined function is registered by default in the 'openml_env' environment.
|
|
408
|
+
User can register it in their own user environment, using the 'openml_user_env' configuration option.
|
|
409
|
+
|
|
410
|
+
PARAMETERS:
|
|
411
|
+
name:
|
|
412
|
+
Required Argument.
|
|
413
|
+
Specifies the name of the user defined function to register.
|
|
414
|
+
Types: str
|
|
415
|
+
|
|
416
|
+
user_function:
|
|
417
|
+
Required Argument.
|
|
418
|
+
Specifies the user defined function to create a column for
|
|
419
|
+
teradataml DataFrame.
|
|
420
|
+
Types: function, udf
|
|
421
|
+
Note:
|
|
422
|
+
Lambda functions are not supported. Re-write the lambda function as regular Python function to use with UDF.
|
|
423
|
+
|
|
424
|
+
returns:
|
|
425
|
+
Optional Argument.
|
|
426
|
+
Specifies the output column type used to register the user defined function.
|
|
427
|
+
Note:
|
|
428
|
+
* If 'user_function' is a udf, then return type of the udf is used as return type
|
|
429
|
+
of the registered user defined function.
|
|
430
|
+
Default Value: VARCHAR(1024)
|
|
431
|
+
Types: teradatasqlalchemy types object
|
|
432
|
+
|
|
433
|
+
RETURNS:
|
|
434
|
+
None
|
|
435
|
+
|
|
436
|
+
RAISES:
|
|
437
|
+
TeradataMLException, TypeError
|
|
438
|
+
|
|
439
|
+
EXAMPLES:
|
|
440
|
+
# Example 1: Register the user defined function to get the values upper case.
|
|
441
|
+
>>> from teradataml.dataframe.functions import udf, register
|
|
442
|
+
>>> @udf
|
|
443
|
+
... def to_upper(s):
|
|
444
|
+
... if s is not None:
|
|
445
|
+
... return s.upper()
|
|
446
|
+
>>>
|
|
447
|
+
# Register the created user defined function.
|
|
448
|
+
>>> register("upper_val", to_upper)
|
|
449
|
+
>>>
|
|
450
|
+
|
|
451
|
+
# Example 2: Register a user defined function to get factorial of a number and
|
|
452
|
+
# store the result in Integer type column.
|
|
453
|
+
>>> from teradataml.dataframe.functions import udf, register
|
|
454
|
+
>>> from teradatasqlalchemy.types import INTEGER
|
|
455
|
+
>>> @udf
|
|
456
|
+
... def factorial(n):
|
|
457
|
+
... import math
|
|
458
|
+
... return math.factorial(n)
|
|
459
|
+
>>>
|
|
460
|
+
# Register the created user defined function.
|
|
461
|
+
>>> register("fact", factorial, INTEGER())
|
|
462
|
+
>>>
|
|
463
|
+
|
|
464
|
+
# Example 3: Register a Python function to get the values upper case.
|
|
465
|
+
>>> from teradataml.dataframe.functions import register
|
|
466
|
+
>>> def to_upper(s):
|
|
467
|
+
... return s.upper()
|
|
468
|
+
>>>
|
|
469
|
+
# Register the created Python function.
|
|
470
|
+
>>> register("upper_val", to_upper)
|
|
471
|
+
>>>
|
|
472
|
+
"""
|
|
473
|
+
|
|
474
|
+
# Validate the arguments.
|
|
475
|
+
arg_matrix = []
|
|
476
|
+
allowed_datatypes = TeradataTypes.TD_ALL_TYPES.value
|
|
477
|
+
arg_matrix.append(["returns", returns, True, allowed_datatypes])
|
|
478
|
+
arg_matrix.append(["name", name, False, str])
|
|
479
|
+
_Validators._validate_function_arguments(arg_matrix)
|
|
480
|
+
|
|
481
|
+
function = []
|
|
482
|
+
# Check if the user_function is Python function or
|
|
483
|
+
# a user defined function(udf) or ColumnExpression returned by udf.
|
|
484
|
+
if isinstance(user_function, ColumnExpression):
|
|
485
|
+
function.append(user_function._udf)
|
|
486
|
+
returns = user_function._type
|
|
487
|
+
elif "udf.<locals>" not in user_function.__qualname__:
|
|
488
|
+
function.append(user_function)
|
|
489
|
+
else:
|
|
490
|
+
user_function = user_function.__call__()
|
|
491
|
+
function.append(user_function._udf)
|
|
492
|
+
returns = user_function._type
|
|
493
|
+
|
|
494
|
+
# Create a dictionary of user defined function name to return type.
|
|
495
|
+
returns = {name: _create_return_type(returns)}
|
|
496
|
+
|
|
497
|
+
exec_mode = 'REMOTE' if UtilFuncs._is_lake() else 'IN-DB'
|
|
498
|
+
|
|
499
|
+
tbl_operators = _TableOperatorUtils([],
|
|
500
|
+
None,
|
|
501
|
+
"register",
|
|
502
|
+
function,
|
|
503
|
+
exec_mode,
|
|
504
|
+
chunk_size=None,
|
|
505
|
+
num_rows=1,
|
|
506
|
+
delimiter=None,
|
|
507
|
+
quotechar=None,
|
|
508
|
+
data_partition_column=None,
|
|
509
|
+
data_hash_column=None,
|
|
510
|
+
style = "csv",
|
|
511
|
+
returns = returns,
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
# Install the file on the lake/enterprise environment.
|
|
515
|
+
if exec_mode == 'REMOTE':
|
|
516
|
+
_Validators._check_auth_token("register")
|
|
517
|
+
env_name = UtilFuncs._get_env_name()
|
|
518
|
+
tbl_operators.__env = get_env(env_name)
|
|
519
|
+
tbl_operators.__env.install_file(tbl_operators.script_path, suppress_output=True, replace=True)
|
|
520
|
+
else:
|
|
521
|
+
install_file(file_identifier=tbl_operators.script_base_name,
|
|
522
|
+
file_path=tbl_operators.script_path,
|
|
523
|
+
suppress_output=True, replace=True)
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
def call_udf(udf_name, func_args = () , **kwargs):
|
|
527
|
+
"""
|
|
528
|
+
DESCRIPTION:
|
|
529
|
+
Call a registered user defined function (UDF).
|
|
530
|
+
|
|
531
|
+
Notes:
|
|
532
|
+
1. Packages required to run the registered user defined function must be installed in remote user
|
|
533
|
+
environment using install_lib method of UserEnv class. Import statements of these
|
|
534
|
+
packages should be inside the user defined function itself.
|
|
535
|
+
2. On VantageCloud Lake, user defined function runs by default in the 'openml_env' environment.
|
|
536
|
+
User can use their own user environment, using the 'openml_user_env' configuration option.
|
|
537
|
+
|
|
538
|
+
PARAMETERS:
|
|
539
|
+
udf_name:
|
|
540
|
+
Required Argument.
|
|
541
|
+
Specifies the name of the registered user defined function.
|
|
542
|
+
Types: str
|
|
543
|
+
|
|
544
|
+
func_args:
|
|
545
|
+
Optional Argument.
|
|
546
|
+
Specifies the arguments to pass to the registered UDF.
|
|
547
|
+
Default Value: ()
|
|
548
|
+
Types: tuple
|
|
549
|
+
|
|
550
|
+
delimiter:
|
|
551
|
+
Optional Argument.
|
|
552
|
+
Specifies a delimiter to use when reading columns from a row and
|
|
553
|
+
writing result columns.
|
|
554
|
+
Notes:
|
|
555
|
+
* This argument cannot be same as "quotechar" argument.
|
|
556
|
+
* This argument cannot be a newline character.
|
|
557
|
+
* Use a different delimiter if categorial columns in the data contains
|
|
558
|
+
a character same as the delimiter.
|
|
559
|
+
Default Value: ','
|
|
560
|
+
Types: one character string
|
|
561
|
+
|
|
562
|
+
quotechar:
|
|
563
|
+
Optional Argument.
|
|
564
|
+
Specifies a character that forces input of the user function
|
|
565
|
+
to be quoted using this specified character.
|
|
566
|
+
Using this argument enables the Analytics Database to
|
|
567
|
+
distinguish between NULL fields and empty strings.
|
|
568
|
+
A string with length zero is quoted, while NULL fields are not.
|
|
569
|
+
Notes:
|
|
570
|
+
* This argument cannot be same as "delimiter" argument.
|
|
571
|
+
* This argument cannot be a newline character.
|
|
572
|
+
Default Value: None
|
|
573
|
+
Types: one character string
|
|
574
|
+
|
|
575
|
+
RETURNS:
|
|
576
|
+
ColumnExpression
|
|
577
|
+
|
|
578
|
+
RAISES:
|
|
579
|
+
TeradataMLException
|
|
580
|
+
|
|
581
|
+
EXAMPLES:
|
|
582
|
+
# Load the data to run the example.
|
|
583
|
+
>>> load_example_data("dataframe", "sales")
|
|
584
|
+
|
|
585
|
+
# Create a DataFrame on 'sales' table.
|
|
586
|
+
>>> import random
|
|
587
|
+
>>> dfsales = DataFrame("sales")
|
|
588
|
+
>>> df = dfsales.assign(id = case([(df.accounts == 'Alpha Co', random.randrange(1, 9)),
|
|
589
|
+
... (df.accounts == 'Blue Inc', random.randrange(1, 9)),
|
|
590
|
+
... (df.accounts == 'Jones LLC', random.randrange(1, 9)),
|
|
591
|
+
... (df.accounts == 'Orange Inc', random.randrange(1, 9)),
|
|
592
|
+
... (df.accounts == 'Yellow Inc', random.randrange(1, 9)),
|
|
593
|
+
... (df.accounts == 'Red Inc', random.randrange(1, 9))]))
|
|
594
|
+
|
|
595
|
+
# Example 1: Register and Call the user defined function to get the values upper case.
|
|
596
|
+
>>> from teradataml.dataframe.functions import udf, register, call_udf
|
|
597
|
+
>>> @udf
|
|
598
|
+
... def to_upper(s):
|
|
599
|
+
... if s is not None:
|
|
600
|
+
... return s.upper()
|
|
601
|
+
>>>
|
|
602
|
+
# Register the created user defined function with name "upper".
|
|
603
|
+
>>> register("upper", to_upper)
|
|
604
|
+
>>>
|
|
605
|
+
# Call the user defined function registered with name "upper" and assign the
|
|
606
|
+
# ColumnExpression returned to the DataFrame.
|
|
607
|
+
>>> res = df.assign(upper_col = call_udf("upper", ('accounts',)))
|
|
608
|
+
>>> res
|
|
609
|
+
Feb Jan Mar Apr datetime id upper_col
|
|
610
|
+
accounts
|
|
611
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 4 YELLOW INC
|
|
612
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 2 ALPHA CO
|
|
613
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 5 JONES LLC
|
|
614
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 3 RED INC
|
|
615
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 1 BLUE INC
|
|
616
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 4 ORANGE INC
|
|
617
|
+
>>>
|
|
618
|
+
|
|
619
|
+
# Example 2: Register and Call user defined function to get factorial of a number
|
|
620
|
+
# and store the result in Integer type column.
|
|
621
|
+
>>> from teradataml.dataframe.functions import udf, register
|
|
622
|
+
>>> @udf(returns = INTEGER())
|
|
623
|
+
... def factorial(n):
|
|
624
|
+
... import math
|
|
625
|
+
... return math.factorial(n)
|
|
626
|
+
>>>
|
|
627
|
+
# Register the created user defined function with name "fact".
|
|
628
|
+
>>> from teradatasqlalchemy.types import INTEGER
|
|
629
|
+
>>> register("fact", factorial)
|
|
630
|
+
>>>
|
|
631
|
+
# Call the user defined function registered with name "fact" and assign the
|
|
632
|
+
# ColumnExpression returned to the DataFrame.
|
|
633
|
+
>>> res = df.assign(fact_col = call_udf("fact", ('id',)))
|
|
634
|
+
>>> res
|
|
635
|
+
Feb Jan Mar Apr datetime id fact_col
|
|
636
|
+
accounts
|
|
637
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 5 120
|
|
638
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 4 24
|
|
639
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 3 6
|
|
640
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 1 1
|
|
641
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 2 2
|
|
642
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 4 24
|
|
643
|
+
>>>
|
|
644
|
+
|
|
645
|
+
# Example 3: Register and Call the Python function to get the values upper case.
|
|
646
|
+
>>> from teradataml.dataframe.functions import register, call_udf
|
|
647
|
+
>>> def to_upper(s):
|
|
648
|
+
... return s.upper()
|
|
649
|
+
>>>
|
|
650
|
+
# Register the created Python function with name "upper".
|
|
651
|
+
>>> register("upper", to_upper, returns = VARCHAR(1024))
|
|
652
|
+
>>>
|
|
653
|
+
# Call the Python function registered with name "upper" and assign the
|
|
654
|
+
# ColumnExpression returned to the DataFrame.
|
|
655
|
+
>>> res = df.assign(upper_col = call_udf("upper", ('accounts',)))
|
|
656
|
+
>>> res
|
|
657
|
+
Feb Jan Mar Apr datetime id upper_col
|
|
658
|
+
accounts
|
|
659
|
+
Yellow Inc 90.0 NaN NaN NaN 17/01/04 4 YELLOW INC
|
|
660
|
+
Alpha Co 210.0 200.0 215.0 250.0 17/01/04 2 ALPHA CO
|
|
661
|
+
Jones LLC 200.0 150.0 140.0 180.0 17/01/04 5 JONES LLC
|
|
662
|
+
Red Inc 200.0 150.0 140.0 NaN 17/01/04 3 RED INC
|
|
663
|
+
Blue Inc 90.0 50.0 95.0 101.0 17/01/04 1 BLUE INC
|
|
664
|
+
Orange Inc 210.0 NaN NaN 250.0 17/01/04 4 ORANGE INC
|
|
665
|
+
>>>
|
|
666
|
+
"""
|
|
667
|
+
env = None
|
|
668
|
+
delimiter = kwargs.pop('delimiter', ',')
|
|
669
|
+
quotechar = kwargs.pop('quotechar', None)
|
|
670
|
+
unknown_args = list(kwargs.keys())
|
|
671
|
+
if len(unknown_args) > 0:
|
|
672
|
+
raise TypeError(Messages.get_message(MessageCodes.UNKNOWN_ARGUMENT,
|
|
673
|
+
"call_udf", unknown_args[0]))
|
|
674
|
+
|
|
675
|
+
if UtilFuncs._is_lake():
|
|
676
|
+
_Validators._check_auth_token("call_udf")
|
|
677
|
+
env = get_env(UtilFuncs._get_env_name())
|
|
678
|
+
file_list = env.files
|
|
679
|
+
if file_list is None:
|
|
680
|
+
raise TeradataMlException(Messages.get_message(
|
|
681
|
+
MessageCodes.FUNC_EXECUTION_FAILED, "'call_udf'", "No UDF is registered with the name '{}'.".format(udf_name)),
|
|
682
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
683
|
+
file_column = 'File'
|
|
684
|
+
else:
|
|
685
|
+
file_list = list_files().to_pandas()
|
|
686
|
+
file_column = 'Files'
|
|
687
|
+
|
|
688
|
+
# Get the script name from the environment that starts with tdml_udf_name_<udf_name>_.
|
|
689
|
+
script_file = [file for file in file_list[file_column] if file.startswith('tdml_udf_name_{}_udf_type_'.format(udf_name))]
|
|
690
|
+
if len(script_file) != 1:
|
|
691
|
+
raise TeradataMlException(Messages.get_message(
|
|
692
|
+
MessageCodes.FUNC_EXECUTION_FAILED, "'call_udf'", "Multiple UDFs or no UDF is registered with the name '{}'.".format(udf_name)),
|
|
693
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
694
|
+
|
|
695
|
+
script_name = script_file[0]
|
|
696
|
+
# Get the return type from the script name.
|
|
697
|
+
x = re.search(r"tdml_udf_name_{}_udf_type_([A-Z_]+)(\d*)_register".format(udf_name), script_name)
|
|
698
|
+
returns = getattr(tdsqlalchemy, x.group(1))
|
|
699
|
+
# If the return type has length, get the length from the script name.
|
|
700
|
+
returns = returns(x.group(2)) if x.group(2) else returns()
|
|
701
|
+
|
|
702
|
+
return _SQLColumnExpression(expression=None, udf_args = func_args, udf_script = script_name, udf_type=returns,\
|
|
703
|
+
delimiter=delimiter, quotechar=quotechar, env_name=env)
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
def list_udfs(show_files=False):
|
|
707
|
+
"""
|
|
708
|
+
DESCRIPTION:
|
|
709
|
+
List all the UDFs registered using 'register()' function.
|
|
710
|
+
|
|
711
|
+
PARAMETERS:
|
|
712
|
+
show_files:
|
|
713
|
+
Optional Argument.
|
|
714
|
+
Specifies whether to show file names or not.
|
|
715
|
+
Default Value: False
|
|
716
|
+
Types: bool
|
|
717
|
+
|
|
718
|
+
RETURNS:
|
|
719
|
+
Pandas DataFrame containing files and it's details or
|
|
720
|
+
None if DataFrame is empty.
|
|
721
|
+
|
|
722
|
+
RAISES:
|
|
723
|
+
TeradataMLException.
|
|
724
|
+
|
|
725
|
+
EXAMPLES:
|
|
726
|
+
# Example 1: Register the user defined function to get the values in lower case,
|
|
727
|
+
then list all the UDFs registered.
|
|
728
|
+
>>> @udf
|
|
729
|
+
... def to_lower(s):
|
|
730
|
+
... if s is not None:
|
|
731
|
+
... return s.lower()
|
|
732
|
+
|
|
733
|
+
# Register the created user defined function.
|
|
734
|
+
>>> register("lower", to_lower)
|
|
735
|
+
|
|
736
|
+
# List all the UDFs registered
|
|
737
|
+
>>> list_udfs(True)
|
|
738
|
+
id name return_type file_name
|
|
739
|
+
0 lower VARCHAR1024 tdml_udf_name_lower_udf_type_VARCHAR1024_register.py
|
|
740
|
+
1 upper VARCHAR1024 tdml_udf_name_upper_udf_type_VARCHAR1024_register.py
|
|
741
|
+
2 add_date DATE tdml_udf_name_add_date_udf_type_DATE_register.py
|
|
742
|
+
3 sum_cols INTEGER tdml_udf_name_sum_cols_udf_type_INTEGER_register.py
|
|
743
|
+
>>>
|
|
744
|
+
"""
|
|
745
|
+
|
|
746
|
+
if UtilFuncs._is_lake():
|
|
747
|
+
_Validators._check_auth_token("list_udfs")
|
|
748
|
+
env_name = UtilFuncs._get_env_name()
|
|
749
|
+
_df = get_env(env_name).files
|
|
750
|
+
if _df is not None:
|
|
751
|
+
# rename the existing DataFrame Column
|
|
752
|
+
_df.rename(columns={'File': 'Files'}, inplace=True)
|
|
753
|
+
_df = _df[_df['Files'].str.startswith('tdml_udf_') & _df['Files'].str.endswith('_register.py')][['Files']]
|
|
754
|
+
if len(_df) == 0:
|
|
755
|
+
print("No files found in remote user environment {}.".format(env_name))
|
|
756
|
+
else:
|
|
757
|
+
return _create_udf_dataframe(_df, show_files)
|
|
758
|
+
|
|
759
|
+
else:
|
|
760
|
+
_df = list_files()
|
|
761
|
+
_df = _df[_df['Files'].startswith('tdml_udf_') & _df['Files'].endswith('_register.py')].to_pandas()
|
|
762
|
+
if len(_df) == 0:
|
|
763
|
+
print("No files found in Vantage")
|
|
764
|
+
else:
|
|
765
|
+
return _create_udf_dataframe(_df, show_files)
|
|
766
|
+
|
|
767
|
+
def _create_udf_dataframe(pandas_df, show_files=False):
|
|
768
|
+
"""
|
|
769
|
+
DESCRIPTION:
|
|
770
|
+
Internal function to return pandas DataFrame with
|
|
771
|
+
column names "id", "name", "return_type", "filename".
|
|
772
|
+
|
|
773
|
+
PARAMETERS:
|
|
774
|
+
pandas_df:
|
|
775
|
+
Required Argument.
|
|
776
|
+
Specifies the pandas DataFrame containing one column 'Files'.
|
|
777
|
+
Types: pandas DataFrame
|
|
778
|
+
|
|
779
|
+
show_files:
|
|
780
|
+
Optional Argument.
|
|
781
|
+
Specifies whether to show file names or not.
|
|
782
|
+
Types: bool
|
|
783
|
+
|
|
784
|
+
RETURNS:
|
|
785
|
+
pandas DataFrame.
|
|
786
|
+
|
|
787
|
+
EXAMPLES:
|
|
788
|
+
>>> _create_udf_dataframe(pandas_dataframe)
|
|
789
|
+
|
|
790
|
+
"""
|
|
791
|
+
_lists = pandas_df.values.tolist()
|
|
792
|
+
_data = {"id": [], "name": [], "return_type": []}
|
|
793
|
+
if show_files:
|
|
794
|
+
_data.update({"file_name": []})
|
|
795
|
+
|
|
796
|
+
for _counter, _list in enumerate(_lists):
|
|
797
|
+
# Extract udf name and type "tdml_udf_name_fact_udf_type_VARCHAR1024_register.py" -> ['fact', 'VARCHAR1024']
|
|
798
|
+
value = _list[0][14:-12].split('_udf_type_')
|
|
799
|
+
_data["id"].append(_counter)
|
|
800
|
+
_data["name"].append(value[0])
|
|
801
|
+
_data["return_type"].append(value[1])
|
|
802
|
+
if show_files:
|
|
803
|
+
_data["file_name"].append(_list[0])
|
|
804
|
+
return pd.DataFrame(_data)
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
def deregister(name, returns=None):
|
|
808
|
+
"""
|
|
809
|
+
DESCRIPTION:
|
|
810
|
+
Deregisters a user defined function (UDF).
|
|
811
|
+
|
|
812
|
+
PARAMETERS:
|
|
813
|
+
name:
|
|
814
|
+
Required Argument.
|
|
815
|
+
Specifies the name of the user defined function to deregister.
|
|
816
|
+
Types: str
|
|
817
|
+
|
|
818
|
+
returns:
|
|
819
|
+
Optional Argument.
|
|
820
|
+
Specifies the type used to deregister the user defined function.
|
|
821
|
+
Types: teradatasqlalchemy types object
|
|
822
|
+
|
|
823
|
+
RETURNS:
|
|
824
|
+
None
|
|
825
|
+
|
|
826
|
+
RAISES:
|
|
827
|
+
TeradataMLException.
|
|
828
|
+
|
|
829
|
+
EXAMPLES:
|
|
830
|
+
# Example 1: Register the user defined function to get the values in lower case,
|
|
831
|
+
# then deregister it.
|
|
832
|
+
>>> @udf
|
|
833
|
+
... def to_lower(s):
|
|
834
|
+
... if s is not None:
|
|
835
|
+
... return s.lower()
|
|
836
|
+
|
|
837
|
+
# Register the created user defined function.
|
|
838
|
+
>>> register("lower", to_lower)
|
|
839
|
+
|
|
840
|
+
# List all the UDFs registered
|
|
841
|
+
>>> list_udfs(True)
|
|
842
|
+
id name return_type file_name
|
|
843
|
+
0 lower VARCHAR1024 tdml_udf_name_lower_udf_type_VARCHAR1024_register.py
|
|
844
|
+
1 upper VARCHAR1024 tdml_udf_name_upper_udf_type_VARCHAR1024_register.py
|
|
845
|
+
2 add_date DATE tdml_udf_name_add_date_udf_type_DATE_register.py
|
|
846
|
+
3 sum_cols INTEGER tdml_udf_name_sum_cols_udf_type_INTEGER_register.py
|
|
847
|
+
>>>
|
|
848
|
+
|
|
849
|
+
# Deregister the created user defined function.
|
|
850
|
+
>>> deregister("lower")
|
|
851
|
+
|
|
852
|
+
# List all the UDFs registered
|
|
853
|
+
>>> list_udfs(True)
|
|
854
|
+
id name return_type file_name
|
|
855
|
+
0 upper VARCHAR1024 tdml_udf_name_upper_udf_type_VARCHAR1024_register.py
|
|
856
|
+
1 add_date DATE tdml_udf_name_add_date_udf_type_DATE_register.py
|
|
857
|
+
2 sum_cols INTEGER tdml_udf_name_sum_cols_udf_type_INTEGER_register.py
|
|
858
|
+
>>>
|
|
859
|
+
|
|
860
|
+
# Example 2: Deregister only specified udf function with it return type.
|
|
861
|
+
>>> @udf(returns=FLOAT())
|
|
862
|
+
... def sum(x, y):
|
|
863
|
+
... return len(x) + y
|
|
864
|
+
|
|
865
|
+
# Deregister the created user defined function.
|
|
866
|
+
>>> register("sum", sum)
|
|
867
|
+
|
|
868
|
+
# List all the UDFs registered
|
|
869
|
+
>>> list_udfs(True)
|
|
870
|
+
id name return_type file_name
|
|
871
|
+
0 sum FLOAT tdml_udf_name_sum_udf_type_FLOAT_register.py
|
|
872
|
+
1 sum INTEGER tdml_udf_name_sum_udf_type_INTEGER_register.py
|
|
873
|
+
>>>
|
|
874
|
+
|
|
875
|
+
# Deregister the created user defined function.
|
|
876
|
+
>>> from teradatasqlalchemy import FLOAT
|
|
877
|
+
>>> deregister("sum", FLOAT())
|
|
878
|
+
|
|
879
|
+
# List all the UDFs registered
|
|
880
|
+
>>> list_udfs(True)
|
|
881
|
+
id name return_type file_name
|
|
882
|
+
0 sum INTEGER tdml_udf_name_sum_udf_type_INTEGER_register.py
|
|
883
|
+
>>>
|
|
884
|
+
"""
|
|
885
|
+
_df = list_udfs(show_files=True)
|
|
886
|
+
# raise Exception list_udfs when DataFrame is empty
|
|
887
|
+
if _df is None:
|
|
888
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
|
|
889
|
+
"'deregister'",
|
|
890
|
+
f"UDF '{name}' does not exist."),
|
|
891
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
892
|
+
|
|
893
|
+
if returns is None:
|
|
894
|
+
_df = _df[_df['file_name'].str.startswith(f'tdml_udf_name_{name}_udf_type_')]
|
|
895
|
+
else:
|
|
896
|
+
_df = _df[_df['file_name'].str.startswith(f'tdml_udf_name_{name}_udf_type_{_create_return_type(returns)}_register.py')]
|
|
897
|
+
|
|
898
|
+
if len(_df) == 0:
|
|
899
|
+
raise TeradataMlException(Messages.get_message(MessageCodes.FUNC_EXECUTION_FAILED,
|
|
900
|
+
"'deregister'",
|
|
901
|
+
f"UDF '{name}' does not exist."),
|
|
902
|
+
MessageCodes.FUNC_EXECUTION_FAILED)
|
|
903
|
+
|
|
904
|
+
_df = _df.values.tolist()
|
|
905
|
+
|
|
906
|
+
# Remove the file on the lake/enterprise environment.
|
|
907
|
+
if UtilFuncs._is_lake():
|
|
908
|
+
env = get_env(UtilFuncs._get_env_name())
|
|
909
|
+
for file_name in _df:
|
|
910
|
+
env.remove_file(file_name[3], suppress_output=True)
|
|
911
|
+
else:
|
|
912
|
+
for file_name in _df:
|
|
913
|
+
remove_file(file_name[3][:-3], force_remove = True, suppress_output = True)
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
def _create_return_type(returns):
|
|
917
|
+
"""
|
|
918
|
+
DESCRIPTION:
|
|
919
|
+
Internal function to return string representation of
|
|
920
|
+
type "returns" in such a way it is included in file name.
|
|
921
|
+
|
|
922
|
+
PARAMETERS:
|
|
923
|
+
returns:
|
|
924
|
+
Required Argument.
|
|
925
|
+
Specifies the teradatasqlalchemy types object.
|
|
926
|
+
Types: teradatasqlalchemy types object
|
|
927
|
+
|
|
928
|
+
RETURNS:
|
|
929
|
+
string
|
|
930
|
+
|
|
931
|
+
EXAMPLES:
|
|
932
|
+
>>> _create_udf_dataframe(VARCHAR(1024))
|
|
933
|
+
'VARCHAR1024'
|
|
934
|
+
"""
|
|
935
|
+
if isinstance(returns, (VARCHAR, CLOB, CHAR)):
|
|
936
|
+
# If the length is not provided, set it to empty string.
|
|
937
|
+
str_len = str(returns.length) if returns.length else ""
|
|
938
|
+
return_str = str(returns) + str_len
|
|
939
|
+
else:
|
|
940
|
+
return_str = str(returns)
|
|
941
|
+
# Replace the space with underscore in the return type.
|
|
942
|
+
return_str = return_str.replace(" ", "_")
|
|
943
|
+
return return_str
|
|
944
|
+
|
|
945
|
+
def td_range(start, end=None, step=1):
|
|
946
|
+
"""
|
|
947
|
+
DESCRIPTION:
|
|
948
|
+
Creates a DataFrame with a specified range of numbers.
|
|
949
|
+
|
|
950
|
+
Notes:
|
|
951
|
+
1. The range is inclusive of the start and exclusive of the end.
|
|
952
|
+
2. If only start is provided, then end is set to start and start is set to 0.
|
|
953
|
+
|
|
954
|
+
PARAMETERS:
|
|
955
|
+
start:
|
|
956
|
+
Required Argument.
|
|
957
|
+
Specifies the starting number of the range.
|
|
958
|
+
Types: int
|
|
959
|
+
|
|
960
|
+
end:
|
|
961
|
+
Optional Argument.
|
|
962
|
+
Specifies the end number of the range(exclusive).
|
|
963
|
+
Default Value: None
|
|
964
|
+
Types: int
|
|
965
|
+
|
|
966
|
+
step:
|
|
967
|
+
Optional Argument.
|
|
968
|
+
Specifies the step size of the range.
|
|
969
|
+
Default Value: 1
|
|
970
|
+
Types: int
|
|
971
|
+
|
|
972
|
+
RETURNS:
|
|
973
|
+
teradataml DataFrame
|
|
974
|
+
|
|
975
|
+
RAISES:
|
|
976
|
+
TeradataMlException
|
|
977
|
+
|
|
978
|
+
EXAMPLES:
|
|
979
|
+
# Example 1: Create a DataFrame with a range of numbers from 0 to 5.
|
|
980
|
+
>>> from teradataml.dataframe.functions import td_range
|
|
981
|
+
>>> df = td_range(5)
|
|
982
|
+
>>> df.sort('id')
|
|
983
|
+
id
|
|
984
|
+
0 0
|
|
985
|
+
1 1
|
|
986
|
+
2 2
|
|
987
|
+
3 3
|
|
988
|
+
4 4
|
|
989
|
+
|
|
990
|
+
# Example 2: Create a DataFrame with a range of numbers from 5 to 1 with step size of -2.
|
|
991
|
+
>>> from teradataml.dataframe.functions import td_range
|
|
992
|
+
>>> td_range(5, 1, -2)
|
|
993
|
+
id
|
|
994
|
+
0 3
|
|
995
|
+
1 5
|
|
996
|
+
|
|
997
|
+
>>> Example 3: Create a DataFrame with a range of numbers from 1 to 5 with default step size of 1.
|
|
998
|
+
>>> from teradataml.dataframe.functions import td_range
|
|
999
|
+
>>> td_range(1, 5)
|
|
1000
|
+
id
|
|
1001
|
+
0 3
|
|
1002
|
+
1 4
|
|
1003
|
+
2 2
|
|
1004
|
+
3 1
|
|
1005
|
+
|
|
1006
|
+
"""
|
|
1007
|
+
# Validate the arguments.
|
|
1008
|
+
arg_matrix = []
|
|
1009
|
+
arg_matrix.append(["start", start, False, int])
|
|
1010
|
+
arg_matrix.append(["end", end, True, int])
|
|
1011
|
+
arg_matrix.append(["step", step, True, int])
|
|
1012
|
+
_Validators._validate_function_arguments(arg_matrix)
|
|
1013
|
+
|
|
1014
|
+
# If only start is provided, then set end to start and start to 0.
|
|
1015
|
+
if end is None:
|
|
1016
|
+
end = start
|
|
1017
|
+
start = 0
|
|
1018
|
+
|
|
1019
|
+
# If start is greater than end, then set the operation to "-" and operator to ">".
|
|
1020
|
+
# If end is less than start, then set the operation to "+" and operator to "<".
|
|
1021
|
+
if end < start:
|
|
1022
|
+
operation, operator, step = "-", ">", -step
|
|
1023
|
+
else:
|
|
1024
|
+
operation, operator = "+", "<"
|
|
1025
|
+
|
|
1026
|
+
# Create a temporary table with the start value.
|
|
1027
|
+
table_name = UtilFuncs._generate_temp_table_name(prefix="tdml_range_df",
|
|
1028
|
+
table_type=TeradataConstants.TERADATA_TABLE)
|
|
1029
|
+
execute_sql(f"CREATE MULTISET TABLE {table_name} AS (SELECT {start} AS id) WITH DATA;")
|
|
1030
|
+
|
|
1031
|
+
# Create a DataFrame from the range query.
|
|
1032
|
+
range_query = TableOperatorConstants.RANGE_QUERY.value \
|
|
1033
|
+
.format(table_name, step, end, operation, operator)
|
|
1034
|
+
df = DataFrame.from_query(range_query)
|
|
1035
|
+
return df
|
|
1036
|
+
|
|
1037
|
+
def current_date(time_zone='local'):
|
|
1038
|
+
"""
|
|
1039
|
+
DESCRIPTION:
|
|
1040
|
+
Returns the current date based on the specified time zone.
|
|
1041
|
+
|
|
1042
|
+
PARAMETERS:
|
|
1043
|
+
time_zone:
|
|
1044
|
+
Optional Argument.
|
|
1045
|
+
Specifies the time zone to use for retrieving the current date.
|
|
1046
|
+
Permitted Values:
|
|
1047
|
+
- "local": Uses the local time zone.
|
|
1048
|
+
- Any valid time zone string.
|
|
1049
|
+
Default Value: "local"
|
|
1050
|
+
Types: str
|
|
1051
|
+
|
|
1052
|
+
RETURNS:
|
|
1053
|
+
ColumnExpression.
|
|
1054
|
+
|
|
1055
|
+
RAISES:
|
|
1056
|
+
None
|
|
1057
|
+
|
|
1058
|
+
EXAMPLES:
|
|
1059
|
+
# Example 1: Add a new column to the DataFrame that contains the
|
|
1060
|
+
# current date as its value. Consider system specified
|
|
1061
|
+
# timezone as timezone.
|
|
1062
|
+
>>> from teradataml.dataframe.functions import current_date
|
|
1063
|
+
>>> load_example_data('dataframe', 'sales')
|
|
1064
|
+
>>> df = DataFrame("sales")
|
|
1065
|
+
>>> df.assign(current_date=current_date())
|
|
1066
|
+
accounts Feb Jan Mar Apr datetime current_date
|
|
1067
|
+
Alpha Co 210.0 200.0 215 250 04/01/2017 25/05/27
|
|
1068
|
+
Blue Inc 90.0 50 95 101 04/01/2017 25/05/27
|
|
1069
|
+
Jones LLC 200.0 150 140 180 04/01/2017 25/05/27
|
|
1070
|
+
Orange Inc 210.0 None None 250 04/01/2017 25/05/27
|
|
1071
|
+
Yellow Inc 90.0 None None None 04/01/2017 25/05/27
|
|
1072
|
+
Red Inc 200.0 150 140 None 04/01/2017 25/05/27
|
|
1073
|
+
|
|
1074
|
+
# Example 2: Add a new column to the DataFrame that contains the
|
|
1075
|
+
# current date in a specific time zone as its value.
|
|
1076
|
+
>>> from teradataml.dataframe.functions import current_date
|
|
1077
|
+
>>> load_example_data('dataframe', 'sales')
|
|
1078
|
+
>>> df = DataFrame("sales")
|
|
1079
|
+
>>> df.assign(current_date=current_date("GMT"))
|
|
1080
|
+
accounts Feb Jan Mar Apr datetime current_date
|
|
1081
|
+
Alpha Co 210.0 200.0 215 250 04/01/2017 25/05/27
|
|
1082
|
+
Blue Inc 90.0 50 95 101 04/01/2017 25/05/27
|
|
1083
|
+
Jones LLC 200.0 150 140 180 04/01/2017 25/05/27
|
|
1084
|
+
Orange Inc 210.0 None None 250 04/01/2017 25/05/27
|
|
1085
|
+
Yellow Inc 90.0 None None None 04/01/2017 25/05/27
|
|
1086
|
+
Red Inc 200.0 150 140 None 04/01/2017 25/05/27
|
|
1087
|
+
|
|
1088
|
+
"""
|
|
1089
|
+
if time_zone == "local":
|
|
1090
|
+
expr_ = "CURRENT_DATE AT LOCAL"
|
|
1091
|
+
else:
|
|
1092
|
+
expr_ = "CURRENT_DATE AT TIME ZONE '{}'".format(time_zone)
|
|
1093
|
+
return _SQLColumnExpression(literal_column(expr_), type = DATE())
|
|
1094
|
+
|
|
1095
|
+
def current_timestamp(time_zone='local'):
|
|
1096
|
+
"""
|
|
1097
|
+
DESCRIPTION:
|
|
1098
|
+
Returns the current timestamp based on the specified time zone.
|
|
1099
|
+
|
|
1100
|
+
PARAMETERS:
|
|
1101
|
+
time_zone:
|
|
1102
|
+
Optional Argument.
|
|
1103
|
+
Specifies the time zone to use for retrieving the current timestamp.
|
|
1104
|
+
Permitted Values:
|
|
1105
|
+
- "local": Uses the local time zone.
|
|
1106
|
+
- Any valid time zone string.
|
|
1107
|
+
Default Value: "local"
|
|
1108
|
+
Types: str
|
|
1109
|
+
|
|
1110
|
+
RETURNS:
|
|
1111
|
+
ColumnExpression.
|
|
1112
|
+
|
|
1113
|
+
RAISES:
|
|
1114
|
+
None
|
|
1115
|
+
|
|
1116
|
+
EXAMPLES:
|
|
1117
|
+
# Example 1: Assign the current timestamp in the local time zone to a DataFrame column.
|
|
1118
|
+
>>> from teradataml.dataframe.functions import current_timestamp
|
|
1119
|
+
>>> load_example_data('dataframe', 'sales')
|
|
1120
|
+
>>> df = DataFrame("sales")
|
|
1121
|
+
>>> df.assign(current_timestamp = current_timestamp())
|
|
1122
|
+
accounts Feb Jan Mar Apr datetime current_timestamp
|
|
1123
|
+
Alpha Co 210.0 200 215 250 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1124
|
+
Blue Inc 90.0 50 95 101 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1125
|
+
Jones LLC 200.0 150 140 180 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1126
|
+
Orange Inc 210.0 None None 250 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1127
|
+
Yellow Inc 90.0 None None None 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1128
|
+
Red Inc 200.0 150 140 None 04/01/2017 2025-05-27 17:36:56.750000+00:00
|
|
1129
|
+
|
|
1130
|
+
# Example 2: Assign the current timestamp in a specific time zone to a DataFrame column.
|
|
1131
|
+
>>> from teradataml.dataframe.functions import current_timestamp
|
|
1132
|
+
>>> load_example_data('dataframe', 'sales')
|
|
1133
|
+
>>> df = DataFrame("sales")
|
|
1134
|
+
>>> df.assign(current_timestamp = current_timestamp("GMT+10"))
|
|
1135
|
+
accounts Feb Jan Mar Apr datetime current_timestamp
|
|
1136
|
+
Blue Inc 90.0 50 95 101 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1137
|
+
Red Inc 200.0 150 140 None 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1138
|
+
Yellow Inc 90.0 None None None 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1139
|
+
Jones LLC 200.0 150 140 180 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1140
|
+
Orange Inc 210.0 None None 250 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1141
|
+
Alpha Co 210.0 200 215 250 04/01/2017 2025-05-28 03:39:00.790000+10:00
|
|
1142
|
+
|
|
1143
|
+
"""
|
|
1144
|
+
|
|
1145
|
+
if time_zone == "local":
|
|
1146
|
+
expr_ = "CURRENT_TIMESTAMP AT LOCAL"
|
|
1147
|
+
else:
|
|
1148
|
+
expr_ = "CURRENT_TIMESTAMP AT TIME ZONE '{}'".format(time_zone)
|
|
1149
|
+
return _SQLColumnExpression(literal_column(expr_), type = TIMESTAMP())
|
|
1150
|
+
|
|
1151
|
+
def get_formatters(formatter_type = None):
|
|
1152
|
+
"""
|
|
1153
|
+
DESCRIPTION:
|
|
1154
|
+
Function to get the formatters for NUMERIC, DATE and CHAR types.
|
|
1155
|
+
|
|
1156
|
+
PARAMETERS:
|
|
1157
|
+
formatter_type:
|
|
1158
|
+
Optional Argument.
|
|
1159
|
+
Specifies the category of formatter to format data.
|
|
1160
|
+
Default Value: None
|
|
1161
|
+
Permitted values:
|
|
1162
|
+
"NUMERIC" - Formatters to convert given data to a numeric type.
|
|
1163
|
+
"DATE" - Formatters to convert given data to a date type.
|
|
1164
|
+
"CHAR" - Formatters to convert given data to a character type.
|
|
1165
|
+
Types: str
|
|
1166
|
+
RAISES:
|
|
1167
|
+
ValueError
|
|
1168
|
+
|
|
1169
|
+
RETURNS:
|
|
1170
|
+
None
|
|
1171
|
+
|
|
1172
|
+
EXAMPLES:
|
|
1173
|
+
# Example 1: Get the formatters for the NUMERIC type.
|
|
1174
|
+
>>> from teradataml.dataframe.functions import get_formatters
|
|
1175
|
+
>>> get_formatters("NUMERIC")
|
|
1176
|
+
|
|
1177
|
+
"""
|
|
1178
|
+
numeric_formatters = """
|
|
1179
|
+
Formatters to convert given data to a Numeric type:
|
|
1180
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1181
|
+
| FORMATTER DESCRIPTION |
|
|
1182
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1183
|
+
| , (comma) A comma in the specified position. |
|
|
1184
|
+
| A comma cannot begin a number format. |
|
|
1185
|
+
| A comma cannot appear to the right of a decimal |
|
|
1186
|
+
| character or period in a number format. |
|
|
1187
|
+
| Example: |
|
|
1188
|
+
| +-------------------------------------------------+ |
|
|
1189
|
+
| | data formatter result | |
|
|
1190
|
+
| +-------------------------------------------------+ |
|
|
1191
|
+
| | "1,234" "9,999" 1234 | |
|
|
1192
|
+
| +-------------------------------------------------+ |
|
|
1193
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1194
|
+
| . (period) A decimal point. Only one allowed in a format. |
|
|
1195
|
+
| Example: |
|
|
1196
|
+
| +-------------------------------------------------+ |
|
|
1197
|
+
| | data formatter result | |
|
|
1198
|
+
| +-------------------------------------------------+ |
|
|
1199
|
+
| | "12.34" "99.99" 12.34 | |
|
|
1200
|
+
| +-------------------------------------------------+ |
|
|
1201
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1202
|
+
| $ A value with a leading dollar sign. |
|
|
1203
|
+
| Example: |
|
|
1204
|
+
| +-------------------------------------------------+ |
|
|
1205
|
+
| | data formatter result | |
|
|
1206
|
+
| +-------------------------------------------------+ |
|
|
1207
|
+
| | "$1234" "$9999" 1234 | |
|
|
1208
|
+
| +-------------------------------------------------+ |
|
|
1209
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1210
|
+
| 0 Leading or trailing zeros. |
|
|
1211
|
+
| Example: |
|
|
1212
|
+
| +-------------------------------------------------+ |
|
|
1213
|
+
| | data formatter result | |
|
|
1214
|
+
| +-------------------------------------------------+ |
|
|
1215
|
+
| | "0123" "0999" 123 | |
|
|
1216
|
+
| | "1230" "9990" 1230 | |
|
|
1217
|
+
| +-------------------------------------------------+ |
|
|
1218
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1219
|
+
| 9 Specified number of digits. |
|
|
1220
|
+
| Leading space if positive, minus if negative. |
|
|
1221
|
+
| Example: |
|
|
1222
|
+
| +-------------------------------------------------+ |
|
|
1223
|
+
| | data formatter result | |
|
|
1224
|
+
| +-------------------------------------------------+ |
|
|
1225
|
+
| | "1234" "9999" 1234 | |
|
|
1226
|
+
| | "-1234" "9999" -1234 | |
|
|
1227
|
+
| +-------------------------------------------------+ |
|
|
1228
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1229
|
+
| B Blanks if integer part is zero. |
|
|
1230
|
+
| Example: |
|
|
1231
|
+
| +-------------------------------------------------+ |
|
|
1232
|
+
| | data formatter result | |
|
|
1233
|
+
| +-------------------------------------------------+ |
|
|
1234
|
+
| | "0" "B9999" 0 | |
|
|
1235
|
+
| +-------------------------------------------------+ |
|
|
1236
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1237
|
+
| C ISO currency symbol (from SDF ISOCurrency). |
|
|
1238
|
+
| Example: |
|
|
1239
|
+
| +-------------------------------------------------+ |
|
|
1240
|
+
| | data formatter result | |
|
|
1241
|
+
| +-------------------------------------------------+ |
|
|
1242
|
+
| | "USD123" "C999" 123 | |
|
|
1243
|
+
| +-------------------------------------------------+ |
|
|
1244
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1245
|
+
| D Radix separator for non-monetary values. |
|
|
1246
|
+
| From SDF RadixSeparator. |
|
|
1247
|
+
| Example: |
|
|
1248
|
+
| +-------------------------------------------------+ |
|
|
1249
|
+
| | data formatter result | |
|
|
1250
|
+
| +-------------------------------------------------+ |
|
|
1251
|
+
| | "12.34" "99D99" 12.34 | |
|
|
1252
|
+
| +-------------------------------------------------+ |
|
|
1253
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1254
|
+
| EEEE Scientific notation. |
|
|
1255
|
+
| Example: |
|
|
1256
|
+
| +-------------------------------------------------+ |
|
|
1257
|
+
| | data formatter result | |
|
|
1258
|
+
| +-------------------------------------------------+ |
|
|
1259
|
+
| | "1.2E+04" "9.9EEEE" 12000 | |
|
|
1260
|
+
| +-------------------------------------------------+ |
|
|
1261
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1262
|
+
| G Group separator for non-monetary values. |
|
|
1263
|
+
| From SDF GroupSeparator. |
|
|
1264
|
+
| Example: |
|
|
1265
|
+
| +-------------------------------------------------+ |
|
|
1266
|
+
| | data formatter result | |
|
|
1267
|
+
| +-------------------------------------------------+ |
|
|
1268
|
+
| | "1,234,567" "9G999G999" 1234567 | |
|
|
1269
|
+
| +-------------------------------------------------+ |
|
|
1270
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1271
|
+
| L Local currency (from SDF Currency element). |
|
|
1272
|
+
| Example: |
|
|
1273
|
+
| +-------------------------------------------------+ |
|
|
1274
|
+
| | data formatter result | |
|
|
1275
|
+
| +-------------------------------------------------+ |
|
|
1276
|
+
| | "$123" "L999" 123 | |
|
|
1277
|
+
| +-------------------------------------------------+ |
|
|
1278
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1279
|
+
| MI Trailing minus sign if value is negative. |
|
|
1280
|
+
| Can only appear in the last position. |
|
|
1281
|
+
| Example: |
|
|
1282
|
+
| +-------------------------------------------------+ |
|
|
1283
|
+
| | data formatter result | |
|
|
1284
|
+
| +-------------------------------------------------+ |
|
|
1285
|
+
| | "1234-" "9999MI" -1234 | |
|
|
1286
|
+
| +-------------------------------------------------+ |
|
|
1287
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1288
|
+
| PR Negative value in angle brackets. |
|
|
1289
|
+
| Positive value with leading/trailing blank. |
|
|
1290
|
+
| Only in the last position. |
|
|
1291
|
+
| Example: |
|
|
1292
|
+
| +-------------------------------------------------+ |
|
|
1293
|
+
| | data formatter result | |
|
|
1294
|
+
| +-------------------------------------------------+ |
|
|
1295
|
+
| | " 123 " "9999PR" 123 | |
|
|
1296
|
+
| +-------------------------------------------------+ |
|
|
1297
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1298
|
+
| S Sign indicator: + / - at beginning or end. |
|
|
1299
|
+
| Can only appear in first or last position. |
|
|
1300
|
+
| Example: |
|
|
1301
|
+
| +-------------------------------------------------+ |
|
|
1302
|
+
| | data formatter result | |
|
|
1303
|
+
| +-------------------------------------------------+ |
|
|
1304
|
+
| | "-1234" "S9999" -1234 | |
|
|
1305
|
+
| +-------------------------------------------------+ |
|
|
1306
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1307
|
+
| U Dual currency (from SDF DualCurrency). |
|
|
1308
|
+
| Example: |
|
|
1309
|
+
| +-------------------------------------------------+ |
|
|
1310
|
+
| | data formatter result | |
|
|
1311
|
+
| +-------------------------------------------------+ |
|
|
1312
|
+
| | "$123" "U999" 123 | |
|
|
1313
|
+
| +-------------------------------------------------+ |
|
|
1314
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1315
|
+
| X Hexadecimal format. |
|
|
1316
|
+
| Accepts only non-negative values. |
|
|
1317
|
+
| Must be preceded by 0 or FM. |
|
|
1318
|
+
| Example: |
|
|
1319
|
+
| +-------------------------------------------------+ |
|
|
1320
|
+
| | data formatter result | |
|
|
1321
|
+
| +-------------------------------------------------+ |
|
|
1322
|
+
| | "FF" "XX" 255 | |
|
|
1323
|
+
| +-------------------------------------------------+ |
|
|
1324
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1325
|
+
"""
|
|
1326
|
+
|
|
1327
|
+
date_formatters = """
|
|
1328
|
+
Formatters to convert given data to a Date type:
|
|
1329
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1330
|
+
| FORMATTER DESCRIPTION |
|
|
1331
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1332
|
+
| - |
|
|
1333
|
+
| / |
|
|
1334
|
+
| , Punctuation characters are ignored and text enclosed in |
|
|
1335
|
+
| . quotation marks is ignored. |
|
|
1336
|
+
| ; |
|
|
1337
|
+
| : |
|
|
1338
|
+
| "text" |
|
|
1339
|
+
| Example: Date with value '2003-12-10' |
|
|
1340
|
+
| +-------------------------------------------------+ |
|
|
1341
|
+
| | data formatter value | |
|
|
1342
|
+
| +-------------------------------------------------+ |
|
|
1343
|
+
| | '2003-12-10' YYYY-MM-DD 03/12/10 | |
|
|
1344
|
+
| +-------------------------------------------------+ |
|
|
1345
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1346
|
+
| D Day of week (1-7). |
|
|
1347
|
+
| Example: day of week with value '2' |
|
|
1348
|
+
| +-------------------------------------------------+ |
|
|
1349
|
+
| | data formatter value | |
|
|
1350
|
+
| +-------------------------------------------------+ |
|
|
1351
|
+
| | 2 D 24/01/01 | |
|
|
1352
|
+
| +-------------------------------------------------+ |
|
|
1353
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1354
|
+
| DAY Name of day. |
|
|
1355
|
+
| Example: Date with value '2024-TUESDAY-01-30' |
|
|
1356
|
+
| +-------------------------------------------------+ |
|
|
1357
|
+
| | data formatter value | |
|
|
1358
|
+
| +-------------------------------------------------+ |
|
|
1359
|
+
| | 2024-TUESDAY-01-30 YYYY-DAY-MM-DD 24/01/30 | |
|
|
1360
|
+
| +-------------------------------------------------+ |
|
|
1361
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1362
|
+
| DD Day of month (1-31). |
|
|
1363
|
+
| Example: Date with value '2003-10-25' |
|
|
1364
|
+
| +-------------------------------------------------+ |
|
|
1365
|
+
| | data formatter value | |
|
|
1366
|
+
| +-------------------------------------------------+ |
|
|
1367
|
+
| | 2003-10-25 YYYY-MM-DD 03/10/25 | |
|
|
1368
|
+
| +-------------------------------------------------+ |
|
|
1369
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1370
|
+
| DDD Day of year (1-366). |
|
|
1371
|
+
| Example: Date with value '2024-366' |
|
|
1372
|
+
| +-------------------------------------------------+ |
|
|
1373
|
+
| | data formatter value | |
|
|
1374
|
+
| +-------------------------------------------------+ |
|
|
1375
|
+
| | 2024-366 YYYY-DDD 24/12/31 | |
|
|
1376
|
+
| +-------------------------------------------------+ |
|
|
1377
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1378
|
+
| DY abbreviated name of day. |
|
|
1379
|
+
| Example: Date with value '2024-Mon-01-29' |
|
|
1380
|
+
| +-------------------------------------------------+ |
|
|
1381
|
+
| | data formatter value | |
|
|
1382
|
+
| +-------------------------------------------------+ |
|
|
1383
|
+
| | 2024-Mon-01-29 YYYY-DY-MM-DD 24/01/29 | |
|
|
1384
|
+
| +-------------------------------------------------+ |
|
|
1385
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1386
|
+
| HH |
|
|
1387
|
+
| HH12 Hour of day (1-12). |
|
|
1388
|
+
| Example: Date with value '2016-01-06 09:08:01' |
|
|
1389
|
+
| +-------------------------------------------------+ |
|
|
1390
|
+
| | data formatter value | |
|
|
1391
|
+
| +-------------------------------------------------+ |
|
|
1392
|
+
| | 2016-01-06 09:08:01 YYYY-MM-DD HH:MI:SS 6/01/06| |
|
|
1393
|
+
| +-------------------------------------------------+ |
|
|
1394
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1395
|
+
| HH24 Hour of the day (0-23). |
|
|
1396
|
+
| Example: Date with value '2016-01-06 23:08:01' |
|
|
1397
|
+
| +----------------------------------------------------+ |
|
|
1398
|
+
| | data formatter value | |
|
|
1399
|
+
| +----------------------------------------------------+ |
|
|
1400
|
+
| | 2016-01-06 23:08:01 YYYY-MM-DD HH24:MI:SS 6/01/06 | |
|
|
1401
|
+
| +----------------------------------------------------+ |
|
|
1402
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1403
|
+
| J Julian day, the number of days since January 1, 4713 BC. |
|
|
1404
|
+
| Number specified with J must be integers. |
|
|
1405
|
+
| Teradata uses the Gregorian calendar in calculations to |
|
|
1406
|
+
| and from Julian Days. |
|
|
1407
|
+
| Example: Number of julian days with value '2457394' |
|
|
1408
|
+
| +-------------------------------------------------+ |
|
|
1409
|
+
| | data formatter value | |
|
|
1410
|
+
| +-------------------------------------------------+ |
|
|
1411
|
+
| | 2457394 J 16/01/06 | |
|
|
1412
|
+
| +-------------------------------------------------+ |
|
|
1413
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1414
|
+
| MI Minute (0-59). |
|
|
1415
|
+
| Example: Date with value '2016-01-06 23:08:01' |
|
|
1416
|
+
| +----------------------------------------------------+ |
|
|
1417
|
+
| | data formatter value | |
|
|
1418
|
+
| +----------------------------------------------------+ |
|
|
1419
|
+
| | 2016-01-06 23:08:01 YYYY-MM-DD HH24:MI:SS 6/01/06 | |
|
|
1420
|
+
| +----------------------------------------------------+ |
|
|
1421
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1422
|
+
| MM Month (01-12). |
|
|
1423
|
+
| Example: Date with value '2016-01-06 23:08:01' |
|
|
1424
|
+
| +----------------------------------------------------+ |
|
|
1425
|
+
| | data formatter value | |
|
|
1426
|
+
| +----------------------------------------------------+ |
|
|
1427
|
+
| | 2016-01-06 23:08:01 YYYY-MM-DD HH24:MI:SS 6/01/06 | |
|
|
1428
|
+
| +----------------------------------------------------+ |
|
|
1429
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1430
|
+
| MON Abbreviated name of month. |
|
|
1431
|
+
| Example: Date with value '2016-JAN-06' |
|
|
1432
|
+
| +----------------------------------------------------+ |
|
|
1433
|
+
| | data formatter value | |
|
|
1434
|
+
| +----------------------------------------------------+ |
|
|
1435
|
+
| | 2016-JAN-06 YYYY-MON-DD 16/01/06 | |
|
|
1436
|
+
| +----------------------------------------------------+ |
|
|
1437
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1438
|
+
| MONTH Name of month. |
|
|
1439
|
+
| Example: Date with value '2016-JANUARY-06' |
|
|
1440
|
+
| +-------------------------------------------------+ |
|
|
1441
|
+
| | data formatter value | |
|
|
1442
|
+
| +-------------------------------------------------+ |
|
|
1443
|
+
| | 2016-JANUARY-06 YYYY-MONTH-DD 16/01/06 | |
|
|
1444
|
+
| +-------------------------------------------------+ |
|
|
1445
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1446
|
+
| PM |
|
|
1447
|
+
| P.M. Meridian indicator. |
|
|
1448
|
+
| Example: Date with value '2016-01-06 23:08:01 PM' |
|
|
1449
|
+
| +---------------------------------------------------------+ |
|
|
1450
|
+
| | data formatter value | |
|
|
1451
|
+
| +---------------------------------------------------------+ |
|
|
1452
|
+
| | 2016-01-06 23:08:01 PM YYYY-MM-DD HH24:MI:SS PM 16/01/06| |
|
|
1453
|
+
| +---------------------------------------------------------+ |
|
|
1454
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1455
|
+
| RM Roman numeral month (I - XII). |
|
|
1456
|
+
| Example: Date with value '2024-XII' |
|
|
1457
|
+
| +-------------------------------------------------+ |
|
|
1458
|
+
| | data formatter value | |
|
|
1459
|
+
| +-------------------------------------------------+ |
|
|
1460
|
+
| | 2024-XII YYYY-RM 24/12/01 | |
|
|
1461
|
+
| +-------------------------------------------------+ |
|
|
1462
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1463
|
+
| RR Stores 20th century dates in the 21st century using only |
|
|
1464
|
+
| 2 digits. If the current year and the specified year are |
|
|
1465
|
+
| both in the range of 0-49, the date is in the current |
|
|
1466
|
+
| century. |
|
|
1467
|
+
| Example: Date with value '2024-365, 21' |
|
|
1468
|
+
| +-------------------------------------------------+ |
|
|
1469
|
+
| | data formatter value | |
|
|
1470
|
+
| +-------------------------------------------------+ |
|
|
1471
|
+
| | 2024-365, 21 YYYY-DDD, RR 21/12/31 | |
|
|
1472
|
+
| +-------------------------------------------------+ |
|
|
1473
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1474
|
+
| RRRR Round year. Accepts either 4-digit or 2-digit input. |
|
|
1475
|
+
| 2-digit input provides the same return as RR. |
|
|
1476
|
+
| Example: Date with value '2024-365, 21' |
|
|
1477
|
+
| +-------------------------------------------------+ |
|
|
1478
|
+
| | data formatter value | |
|
|
1479
|
+
| +-------------------------------------------------+ |
|
|
1480
|
+
| | 2024-365, 21 YYYY-DDD, RRRR 24/12/31 | |
|
|
1481
|
+
| +-------------------------------------------------+ |
|
|
1482
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1483
|
+
| SS Second (0-59). |
|
|
1484
|
+
| Example: Date with value '2016-01-06 23:08:01' |
|
|
1485
|
+
| +----------------------------------------------------+ |
|
|
1486
|
+
| | data formatter value | |
|
|
1487
|
+
| +----------------------------------------------------+ |
|
|
1488
|
+
| | 2016-01-06 23:08:01 YYYY-MM-DD HH24:MI:SS 6/01/06 | |
|
|
1489
|
+
| +----------------------------------------------------+ |
|
|
1490
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1491
|
+
| SSSSS Seconds past midnight (0-86399). |
|
|
1492
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1493
|
+
| TZH Time zone hour. |
|
|
1494
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1495
|
+
| TZM Time zone minute. |
|
|
1496
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1497
|
+
| X Local radix character. |
|
|
1498
|
+
| Example: Date with value '2024.366' |
|
|
1499
|
+
| +-------------------------------------------------+ |
|
|
1500
|
+
| | data formatter value | |
|
|
1501
|
+
| +-------------------------------------------------+ |
|
|
1502
|
+
| | 2024.366 YYYYXDDD 24/12/31 | |
|
|
1503
|
+
| +-------------------------------------------------+ |
|
|
1504
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1505
|
+
| Y,YYY Year with comma in this position. |
|
|
1506
|
+
| Example: Date with value '2,024-366' |
|
|
1507
|
+
| +-------------------------------------------------+ |
|
|
1508
|
+
| | data formatter value | |
|
|
1509
|
+
| +-------------------------------------------------+ |
|
|
1510
|
+
| | 2,024-366 Y,YYY-DDD 24/12/31 | |
|
|
1511
|
+
| +-------------------------------------------------+ |
|
|
1512
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1513
|
+
| YYYY |
|
|
1514
|
+
| SYYYY 4-digit year. S prefixes BC dates with a minus sign. |
|
|
1515
|
+
| Example: Date with value '2024-366' |
|
|
1516
|
+
| +-------------------------------------------------+ |
|
|
1517
|
+
| | data formatter value | |
|
|
1518
|
+
| +-------------------------------------------------+ |
|
|
1519
|
+
| | 2024-366 YYYY-DDD 24/12/31 | |
|
|
1520
|
+
| +-------------------------------------------------+ |
|
|
1521
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1522
|
+
| YYY Last 3, 2, or 1 digit of year. |
|
|
1523
|
+
| YY If the current year and the specified year are both in |
|
|
1524
|
+
| Y the range of 0-49, the date is in the current century. |
|
|
1525
|
+
| Example: Date with value '24-366' |
|
|
1526
|
+
| +-------------------------------------------------+ |
|
|
1527
|
+
| | data formatter value | |
|
|
1528
|
+
| +-------------------------------------------------+ |
|
|
1529
|
+
| | 24-366 YY-DDD 24/12/31 | |
|
|
1530
|
+
| +-------------------------------------------------+ |
|
|
1531
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1532
|
+
"""
|
|
1533
|
+
|
|
1534
|
+
char_formatters = """
|
|
1535
|
+
Formatters to convert given data to a Char type:
|
|
1536
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1537
|
+
| FORMATTER DESCRIPTION |
|
|
1538
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1539
|
+
| , (comma) A comma in the specified position. |
|
|
1540
|
+
| A comma cannot begin a number format. |
|
|
1541
|
+
| A comma cannot appear to the right of a decimal |
|
|
1542
|
+
| character or period in a number format. |
|
|
1543
|
+
| Example: |
|
|
1544
|
+
| +-------------------------------------------------+ |
|
|
1545
|
+
| | data formatter result | |
|
|
1546
|
+
| +-------------------------------------------------+ |
|
|
1547
|
+
| | 1234 9,999 1,234 | |
|
|
1548
|
+
| +-------------------------------------------------+ |
|
|
1549
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1550
|
+
| . (period) A decimal point. |
|
|
1551
|
+
| User can only specify one period in a number format. |
|
|
1552
|
+
| Example: |
|
|
1553
|
+
| +-------------------------------------------------+ |
|
|
1554
|
+
| | data formatter result | |
|
|
1555
|
+
| +-------------------------------------------------+ |
|
|
1556
|
+
| | 123.46 9999.9 123.5 | |
|
|
1557
|
+
| +-------------------------------------------------+ |
|
|
1558
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1559
|
+
| $ A value with a leading dollar sign. |
|
|
1560
|
+
| Example: |
|
|
1561
|
+
| +-------------------------------------------------+ |
|
|
1562
|
+
| | data formatter result | |
|
|
1563
|
+
| +-------------------------------------------------+ |
|
|
1564
|
+
| | 1234 $9999 $1234 | |
|
|
1565
|
+
| +-------------------------------------------------+ |
|
|
1566
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1567
|
+
| 0 Leading zeros. |
|
|
1568
|
+
| Trailing zeros. |
|
|
1569
|
+
| Example: |
|
|
1570
|
+
| +-------------------------------------------------+ |
|
|
1571
|
+
| | data formatter result | |
|
|
1572
|
+
| +-------------------------------------------------+ |
|
|
1573
|
+
| | 1234 09999 01234 | |
|
|
1574
|
+
| +-------------------------------------------------+ |
|
|
1575
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1576
|
+
| 9 A value with the specified number of digits with a |
|
|
1577
|
+
| leading space if positive or with a leading minus |
|
|
1578
|
+
| if negative. |
|
|
1579
|
+
| Example: |
|
|
1580
|
+
| +-------------------------------------------------+ |
|
|
1581
|
+
| | data formatter result | |
|
|
1582
|
+
| +-------------------------------------------------+ |
|
|
1583
|
+
| | 1234 9999 1234 | |
|
|
1584
|
+
| | 1234 999 #### | |
|
|
1585
|
+
| +-------------------------------------------------+ |
|
|
1586
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1587
|
+
| B Blank space for the integer part of a fixed point number|
|
|
1588
|
+
| when the integer part is zero. |
|
|
1589
|
+
| Example: |
|
|
1590
|
+
| +-------------------------------------------------+ |
|
|
1591
|
+
| | data formatter result | |
|
|
1592
|
+
| +-------------------------------------------------+ |
|
|
1593
|
+
| | 0.1234 B.999 Blank space| |
|
|
1594
|
+
| +-------------------------------------------------+ |
|
|
1595
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1596
|
+
| C The ISO currency symbol as specified in the ISOCurrency |
|
|
1597
|
+
| element in the SDF file. |
|
|
1598
|
+
| Example: |
|
|
1599
|
+
| +-------------------------------------------------+ |
|
|
1600
|
+
| | data formatter result | |
|
|
1601
|
+
| +-------------------------------------------------+ |
|
|
1602
|
+
| | 234 C999 USD234 | |
|
|
1603
|
+
| +-------------------------------------------------+ |
|
|
1604
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1605
|
+
| D The character that separates the integer and fractional |
|
|
1606
|
+
| part of non-monetary values. |
|
|
1607
|
+
| Example: |
|
|
1608
|
+
| +-------------------------------------------------+ |
|
|
1609
|
+
| | data formatter result | |
|
|
1610
|
+
| +-------------------------------------------------+ |
|
|
1611
|
+
| | 234.56 999D9 234.6 | |
|
|
1612
|
+
| +-------------------------------------------------+ |
|
|
1613
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1614
|
+
| EEEE A value in scientific notation. |
|
|
1615
|
+
| Example: |
|
|
1616
|
+
| +-------------------------------------------------+ |
|
|
1617
|
+
| | data formatter result | |
|
|
1618
|
+
| +-------------------------------------------------+ |
|
|
1619
|
+
| | 234.56 9.9EEEE 2.3E+02 | |
|
|
1620
|
+
| +-------------------------------------------------+ |
|
|
1621
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1622
|
+
| G The character that separates groups of digits in the |
|
|
1623
|
+
| integer part of non-monetary values. |
|
|
1624
|
+
| +-------------------------------------------------+ |
|
|
1625
|
+
| | data formatter result | |
|
|
1626
|
+
| +-------------------------------------------------+ |
|
|
1627
|
+
| | 123456 9G99G99 1,234,56 | |
|
|
1628
|
+
| +-------------------------------------------------+ |
|
|
1629
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1630
|
+
| L The string representing the local currency as specified |
|
|
1631
|
+
| in the Currency element according to system settings. |
|
|
1632
|
+
| Example: |
|
|
1633
|
+
| +-------------------------------------------------+ |
|
|
1634
|
+
| | data formatter result | |
|
|
1635
|
+
| +-------------------------------------------------+ |
|
|
1636
|
+
| | 234 L999 $234 | |
|
|
1637
|
+
| +-------------------------------------------------+ |
|
|
1638
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1639
|
+
| MI A trailing minus sign if the value is negative. |
|
|
1640
|
+
| The MI format element can appear only in the last |
|
|
1641
|
+
| position of a number format. |
|
|
1642
|
+
| Example: |
|
|
1643
|
+
| +-------------------------------------------------+ |
|
|
1644
|
+
| | data formatter result | |
|
|
1645
|
+
| +-------------------------------------------------+ |
|
|
1646
|
+
| | -1234 9999MI 1234- | |
|
|
1647
|
+
| +-------------------------------------------------+ |
|
|
1648
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1649
|
+
| PR A negative value in <angle brackets>, or |
|
|
1650
|
+
| a positive value with a leading and trailing blank. |
|
|
1651
|
+
| The PR format element can appear only in the last |
|
|
1652
|
+
| position of a number format. |
|
|
1653
|
+
| Example: |
|
|
1654
|
+
| +-------------------------------------------------+ |
|
|
1655
|
+
| | data formatter result | |
|
|
1656
|
+
| +-------------------------------------------------+ |
|
|
1657
|
+
| | -1234 9999PR <1234> | |
|
|
1658
|
+
| +-------------------------------------------------+ |
|
|
1659
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1660
|
+
| S A negative value with a leading or trailing minus sign. |
|
|
1661
|
+
| a positive value with a leading or trailing plus sign. |
|
|
1662
|
+
| The S format element can appear only in the first or |
|
|
1663
|
+
| last position of a number format. |
|
|
1664
|
+
| Example: |
|
|
1665
|
+
| +-------------------------------------------------+ |
|
|
1666
|
+
| | data formatter result | |
|
|
1667
|
+
| +-------------------------------------------------+ |
|
|
1668
|
+
| | +1234 S9999 +1234 | |
|
|
1669
|
+
| +-------------------------------------------------+ |
|
|
1670
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1671
|
+
| TM (text minimum format) Returns the smallest number of |
|
|
1672
|
+
| characters possible. This element is case insensitive. |
|
|
1673
|
+
| TM or TM9 return the number in fixed notation unless |
|
|
1674
|
+
| the output exceeds 64 characters. If the output exceeds |
|
|
1675
|
+
| 64 characters, the number is returned in scientific |
|
|
1676
|
+
| notation. |
|
|
1677
|
+
| TME returns the number in scientific notation with the |
|
|
1678
|
+
| smallest number of characters. |
|
|
1679
|
+
| You cannot precede this element with an other element. |
|
|
1680
|
+
| You can follow this element only with one 9 or one E |
|
|
1681
|
+
| (or e), but not with any combination of these. |
|
|
1682
|
+
| Example: |
|
|
1683
|
+
| +-------------------------------------------------+ |
|
|
1684
|
+
| | data formatter result | |
|
|
1685
|
+
| +-------------------------------------------------+ |
|
|
1686
|
+
| | 1234 TM 1234 | |
|
|
1687
|
+
| +-------------------------------------------------+ |
|
|
1688
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1689
|
+
| U (dual currency) The string that represents the dual |
|
|
1690
|
+
| currency as specified in the DualCurrency element |
|
|
1691
|
+
| according to system settings. |
|
|
1692
|
+
| Example: |
|
|
1693
|
+
| +-------------------------------------------------+ |
|
|
1694
|
+
| | data formatter result | |
|
|
1695
|
+
| +-------------------------------------------------+ |
|
|
1696
|
+
| | 1234 U9999 $1234 | |
|
|
1697
|
+
| +-------------------------------------------------+ |
|
|
1698
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1699
|
+
| V A value multiplied by 10 to the n (and, if necessary, |
|
|
1700
|
+
| rounded up), where n is the number of 9's after the V. |
|
|
1701
|
+
| Example: |
|
|
1702
|
+
| +-------------------------------------------------+ |
|
|
1703
|
+
| | data formatter result | |
|
|
1704
|
+
| +-------------------------------------------------+ |
|
|
1705
|
+
| | 1234 9999V99 123400 | |
|
|
1706
|
+
| +-------------------------------------------------+ |
|
|
1707
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1708
|
+
| X The hexadecimal value of the specified number of digits.|
|
|
1709
|
+
| If the specified number is not an integer, the function |
|
|
1710
|
+
| will round it to an integer. |
|
|
1711
|
+
| This element accepts only positive values or zero. |
|
|
1712
|
+
| Negative values return an error. You can precede this |
|
|
1713
|
+
| element only with zero (which returns leading zeros) or |
|
|
1714
|
+
| FM. Any other elements return an error. If you do not |
|
|
1715
|
+
| specify zero or FM, the return always has one leading |
|
|
1716
|
+
| blank. |
|
|
1717
|
+
| Example: |
|
|
1718
|
+
| +-------------------------------------------------+ |
|
|
1719
|
+
| | data formatter result | |
|
|
1720
|
+
| +-------------------------------------------------+ |
|
|
1721
|
+
| | 1234 XXXX 4D2 | |
|
|
1722
|
+
| +-------------------------------------------------+ |
|
|
1723
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1724
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1725
|
+
| FORMATTER DESCRIPTION |
|
|
1726
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1727
|
+
| - |
|
|
1728
|
+
| / |
|
|
1729
|
+
| , Punctuation characters are ignored and text enclosed in |
|
|
1730
|
+
| . quotation marks is ignored. |
|
|
1731
|
+
| ; |
|
|
1732
|
+
| : |
|
|
1733
|
+
| "text" |
|
|
1734
|
+
| Example: |
|
|
1735
|
+
| +-------------------------------------------------+ |
|
|
1736
|
+
| | data formatter result | |
|
|
1737
|
+
| +-------------------------------------------------+ |
|
|
1738
|
+
| | 03/09/17 MM-DD 09-17 | |
|
|
1739
|
+
| +-------------------------------------------------+ |
|
|
1740
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1741
|
+
| AD AD indicator. |
|
|
1742
|
+
| A.D. |
|
|
1743
|
+
| Example: |
|
|
1744
|
+
| +-------------------------------------------------+ |
|
|
1745
|
+
| | data formatter result | |
|
|
1746
|
+
| +-------------------------------------------------+ |
|
|
1747
|
+
| | 03/09/17 CCAD 21AD | |
|
|
1748
|
+
| +-------------------------------------------------+ |
|
|
1749
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1750
|
+
| AM Meridian indicator. |
|
|
1751
|
+
| A.M. |
|
|
1752
|
+
| Example: |
|
|
1753
|
+
| +-------------------------------------------------+ |
|
|
1754
|
+
| | data formatter result | |
|
|
1755
|
+
| +-------------------------------------------------+ |
|
|
1756
|
+
| | 03/09/17 CCAM 21AM | |
|
|
1757
|
+
| +-------------------------------------------------+ |
|
|
1758
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1759
|
+
| BC |
|
|
1760
|
+
| B.C. BC indicator. |
|
|
1761
|
+
| Example: |
|
|
1762
|
+
| +-------------------------------------------------+ |
|
|
1763
|
+
| | data formatter result | |
|
|
1764
|
+
| +-------------------------------------------------+ |
|
|
1765
|
+
| | 03/09/17 CCBC 21BC | |
|
|
1766
|
+
| +-------------------------------------------------+ |
|
|
1767
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1768
|
+
| CC Century. |
|
|
1769
|
+
| SCC If the last 2 digits of a 4-digit year are between 01 |
|
|
1770
|
+
| and 99 inclusive, the century is 1 greater than the |
|
|
1771
|
+
| first 2 digits of that year. |
|
|
1772
|
+
| If the last 2 digits of a 4-digit year are 00, the |
|
|
1773
|
+
| century is the same as the first 2 digits of that year. |
|
|
1774
|
+
| Example: |
|
|
1775
|
+
| +-------------------------------------------------+ |
|
|
1776
|
+
| | data formatter result | |
|
|
1777
|
+
| +-------------------------------------------------+ |
|
|
1778
|
+
| | 03/09/17 CCBC 21BC | |
|
|
1779
|
+
| +-------------------------------------------------+ |
|
|
1780
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1781
|
+
| D Day of week (1-7). |
|
|
1782
|
+
| Example: |
|
|
1783
|
+
| +-------------------------------------------------+ |
|
|
1784
|
+
| | data formatter result | |
|
|
1785
|
+
| +-------------------------------------------------+ |
|
|
1786
|
+
| | 03/09/17 D 4 | |
|
|
1787
|
+
| +-------------------------------------------------+ |
|
|
1788
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1789
|
+
| DAY Name of day. |
|
|
1790
|
+
| Example: |
|
|
1791
|
+
| +-------------------------------------------------+ |
|
|
1792
|
+
| | data formatter result | |
|
|
1793
|
+
| +-------------------------------------------------+ |
|
|
1794
|
+
| | 03/09/17 DAY WEDNESDAY | |
|
|
1795
|
+
| +-------------------------------------------------+ |
|
|
1796
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1797
|
+
| DD Day of month (1-31). |
|
|
1798
|
+
| Example: |
|
|
1799
|
+
| +-------------------------------------------------+ |
|
|
1800
|
+
| | data formatter result | |
|
|
1801
|
+
| +-------------------------------------------------+ |
|
|
1802
|
+
| | 03/09/17 DD 17 | |
|
|
1803
|
+
| +-------------------------------------------------+ |
|
|
1804
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1805
|
+
| DDD Day of year (1-366). |
|
|
1806
|
+
| Example: |
|
|
1807
|
+
| +-------------------------------------------------+ |
|
|
1808
|
+
| | data formatter result | |
|
|
1809
|
+
| +-------------------------------------------------+ |
|
|
1810
|
+
| | 03/09/17 DDD 260 | |
|
|
1811
|
+
| +-------------------------------------------------+ |
|
|
1812
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1813
|
+
| DL Date Long. Equivalent to the format string ‘FMDay, |
|
|
1814
|
+
| Month FMDD, YYYY’. |
|
|
1815
|
+
| Example: |
|
|
1816
|
+
| +-------------------------------------------------+ |
|
|
1817
|
+
| | data formatter result | |
|
|
1818
|
+
| +-------------------------------------------------+ |
|
|
1819
|
+
| | 03/09/17 DL Wednesday, September 17, 2003| |
|
|
1820
|
+
| +-------------------------------------------------+ |
|
|
1821
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1822
|
+
| DS Date Short. Equivalent to the format string |
|
|
1823
|
+
| ‘FMMM/DD/YYYYFM’. |
|
|
1824
|
+
| Example: |
|
|
1825
|
+
| +-------------------------------------------------+ |
|
|
1826
|
+
| | data formatter result | |
|
|
1827
|
+
| +-------------------------------------------------+ |
|
|
1828
|
+
| | 03/09/17 DS 9/17/2003 | |
|
|
1829
|
+
| +-------------------------------------------------+ |
|
|
1830
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1831
|
+
| DY abbreviated name of day. |
|
|
1832
|
+
| Example: |
|
|
1833
|
+
| +-------------------------------------------------+ |
|
|
1834
|
+
| | data formatter result | |
|
|
1835
|
+
| +-------------------------------------------------+ |
|
|
1836
|
+
| | 03/09/17 DY WED | |
|
|
1837
|
+
| +-------------------------------------------------+ |
|
|
1838
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1839
|
+
| FF [1..9] Fractional seconds. |
|
|
1840
|
+
| Use [1..9] to specify the number of fractional digits. |
|
|
1841
|
+
| FF without any number following it prints a decimal |
|
|
1842
|
+
| followed by digits equal to the number of fractional |
|
|
1843
|
+
| seconds in the input data type. If the data type has no |
|
|
1844
|
+
| fractional digits, FF prints nothing. |
|
|
1845
|
+
| Any fractional digits beyond 6 digits are truncated. |
|
|
1846
|
+
| Example: |
|
|
1847
|
+
| +-------------------------------------------------+ |
|
|
1848
|
+
| | data formatter result | |
|
|
1849
|
+
| +-------------------------------------------------+ |
|
|
1850
|
+
| | 2016-01-06 09:08:01.000000 FF 000000 | |
|
|
1851
|
+
| +-------------------------------------------------+ |
|
|
1852
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1853
|
+
| HH |
|
|
1854
|
+
| HH12 Hour of day (1-12). |
|
|
1855
|
+
| Example: |
|
|
1856
|
+
| +-------------------------------------------------+ |
|
|
1857
|
+
| | data formatter result | |
|
|
1858
|
+
| +-------------------------------------------------+ |
|
|
1859
|
+
| | 2016-01-06 09:08:01.000000 HH 09 | |
|
|
1860
|
+
| +-------------------------------------------------+ |
|
|
1861
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1862
|
+
| HH24 Hour of the day (0-23). |
|
|
1863
|
+
| Example: |
|
|
1864
|
+
| +-------------------------------------------------+ |
|
|
1865
|
+
| | data formatter result | |
|
|
1866
|
+
| +-------------------------------------------------+ |
|
|
1867
|
+
| | 2016-01-06 09:08:01.000000 HH24 09 | |
|
|
1868
|
+
| +-------------------------------------------------+ |
|
|
1869
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1870
|
+
| IW Week of year (1-52 or 1-53) based on ISO model. |
|
|
1871
|
+
| Example: |
|
|
1872
|
+
| +-------------------------------------------------+ |
|
|
1873
|
+
| | data formatter result | |
|
|
1874
|
+
| +-------------------------------------------------+ |
|
|
1875
|
+
| | 2016-01-06 09:08:01.000000 IW 01 | |
|
|
1876
|
+
| +-------------------------------------------------+ |
|
|
1877
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1878
|
+
| IYY |
|
|
1879
|
+
| IY Last 3, 2, or 1 digits of ISO year. |
|
|
1880
|
+
| I |
|
|
1881
|
+
| Example: |
|
|
1882
|
+
| +-------------------------------------------------+ |
|
|
1883
|
+
| | data formatter result | |
|
|
1884
|
+
| +-------------------------------------------------+ |
|
|
1885
|
+
| | 2016-01-06 09:08:01.000000 IY 16 | |
|
|
1886
|
+
| +-------------------------------------------------+ |
|
|
1887
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1888
|
+
| IYYY 4-digit year based on the ISO standard. |
|
|
1889
|
+
| Example: |
|
|
1890
|
+
| +-------------------------------------------------+ |
|
|
1891
|
+
| | data formatter result | |
|
|
1892
|
+
| +-------------------------------------------------+ |
|
|
1893
|
+
| | 2016-01-06 09:08:01.000000 IYYY 2016 | |
|
|
1894
|
+
| +-------------------------------------------------+ |
|
|
1895
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1896
|
+
| J Julian day, the number of days since January 1, 4713 BC. |
|
|
1897
|
+
| Number specified with J must be integers. |
|
|
1898
|
+
| Teradata uses the Gregorian calendar in calculations to |
|
|
1899
|
+
| and from Julian Days. |
|
|
1900
|
+
| Example: |
|
|
1901
|
+
| +-------------------------------------------------+ |
|
|
1902
|
+
| | data formatter result | |
|
|
1903
|
+
| +-------------------------------------------------+ |
|
|
1904
|
+
| | 2016-01-06 09:08:01.000000 J 2457394 | |
|
|
1905
|
+
| +-------------------------------------------------+ |
|
|
1906
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1907
|
+
| MI Minute (0-59). |
|
|
1908
|
+
| Example: |
|
|
1909
|
+
| +-------------------------------------------------+ |
|
|
1910
|
+
| | data formatter result | |
|
|
1911
|
+
| +-------------------------------------------------+ |
|
|
1912
|
+
| | 2016-01-06 09:08:01.000000 MI 08 | |
|
|
1913
|
+
| +-------------------------------------------------+ |
|
|
1914
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1915
|
+
| MM Month (01-12). |
|
|
1916
|
+
| Example: |
|
|
1917
|
+
| +-------------------------------------------------+ |
|
|
1918
|
+
| | data formatter result | |
|
|
1919
|
+
| +-------------------------------------------------+ |
|
|
1920
|
+
| | 2016-01-06 09:08:01.000000 MM 01 | |
|
|
1921
|
+
| +-------------------------------------------------+ |
|
|
1922
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1923
|
+
| MON Abbreviated name of month. |
|
|
1924
|
+
| Example: |
|
|
1925
|
+
| +-------------------------------------------------+ |
|
|
1926
|
+
| | data formatter result | |
|
|
1927
|
+
| +-------------------------------------------------+ |
|
|
1928
|
+
| | 2016-01-06 09:08:01.000000 MON JAN | |
|
|
1929
|
+
| +-------------------------------------------------+ |
|
|
1930
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1931
|
+
| MONTH Name of month. |
|
|
1932
|
+
| Example: |
|
|
1933
|
+
| +-------------------------------------------------+ |
|
|
1934
|
+
| | data formatter result | |
|
|
1935
|
+
| +-------------------------------------------------+ |
|
|
1936
|
+
| | 2016-01-06 09:08:01.000000 MONTH JANUARY | |
|
|
1937
|
+
| +-------------------------------------------------+ |
|
|
1938
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1939
|
+
| PM |
|
|
1940
|
+
| P.M. Meridian indicator. |
|
|
1941
|
+
| Example: |
|
|
1942
|
+
| +-------------------------------------------------+ |
|
|
1943
|
+
| | data formatter result | |
|
|
1944
|
+
| +-------------------------------------------------+ |
|
|
1945
|
+
| | 2016-01-06 09:08:01.000000 HHPM 09PM | |
|
|
1946
|
+
| +-------------------------------------------------+ |
|
|
1947
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1948
|
+
| Q Quarter of year (1, 2, 3, 4). |
|
|
1949
|
+
| Example: |
|
|
1950
|
+
| +-------------------------------------------------+ |
|
|
1951
|
+
| | data formatter result | |
|
|
1952
|
+
| +-------------------------------------------------+ |
|
|
1953
|
+
| | 2016-01-06 09:08:01.000000 Q 1 | |
|
|
1954
|
+
| +-------------------------------------------------+ |
|
|
1955
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1956
|
+
| RM Roman numeral month (I - XII). |
|
|
1957
|
+
| Example: |
|
|
1958
|
+
| +-------------------------------------------------+ |
|
|
1959
|
+
| | data formatter result | |
|
|
1960
|
+
| +-------------------------------------------------+ |
|
|
1961
|
+
| | 2016-01-06 09:08:01.000000 RM I | |
|
|
1962
|
+
| +-------------------------------------------------+ |
|
|
1963
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1964
|
+
| SP Spelled. Any numeric element followed by SP is spelled in|
|
|
1965
|
+
| English words. The words are capitalized according to how|
|
|
1966
|
+
| the element is capitalized. |
|
|
1967
|
+
| For example: 'DDDSP' specifies all uppercase, 'DddSP' |
|
|
1968
|
+
| specifies that the first letter is capitalized, and |
|
|
1969
|
+
| 'dddSP' specifies all lowercase. |
|
|
1970
|
+
| Example: |
|
|
1971
|
+
| +-------------------------------------------------+ |
|
|
1972
|
+
| | data formatter result | |
|
|
1973
|
+
| +-------------------------------------------------+ |
|
|
1974
|
+
| | 2016-01-06 09:08:01.000000 HHSP NINE | |
|
|
1975
|
+
| +-------------------------------------------------+ |
|
|
1976
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1977
|
+
| SS Second (0-59). |
|
|
1978
|
+
| Example: |
|
|
1979
|
+
| +-------------------------------------------------+ |
|
|
1980
|
+
| | data formatter result | |
|
|
1981
|
+
| +-------------------------------------------------+ |
|
|
1982
|
+
| | 2016-01-06 09:08:01.000000 SS 03 | |
|
|
1983
|
+
| +-------------------------------------------------+ |
|
|
1984
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1985
|
+
| SSSSS Seconds past midnight (0-86399). |
|
|
1986
|
+
| Example: |
|
|
1987
|
+
| +-------------------------------------------------+ |
|
|
1988
|
+
| | data formatter result | |
|
|
1989
|
+
| +-------------------------------------------------+ |
|
|
1990
|
+
| | 2016-01-06 09:08:01.000000 SSSSS 32883 | |
|
|
1991
|
+
| +-------------------------------------------------+ |
|
|
1992
|
+
+--------------------------------------------------------------------------------------------------+
|
|
1993
|
+
| TS Time Short. Equivalent to the format string |
|
|
1994
|
+
| 'HH:MI:SS AM'. |
|
|
1995
|
+
| Example: |
|
|
1996
|
+
| +-------------------------------------------------+ |
|
|
1997
|
+
| | data formatter result | |
|
|
1998
|
+
| +-------------------------------------------------+ |
|
|
1999
|
+
| | 2016-01-06 09:08:01.000000 TS 09:08:01 AM | |
|
|
2000
|
+
| +-------------------------------------------------+ |
|
|
2001
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2002
|
+
| TZH Time zone hour. |
|
|
2003
|
+
| Example: |
|
|
2004
|
+
| +-------------------------------------------------+ |
|
|
2005
|
+
| | data formatter result | |
|
|
2006
|
+
| +-------------------------------------------------+ |
|
|
2007
|
+
| | 2016-01-06 09:08:01.000000 TZH +00 | |
|
|
2008
|
+
| +-------------------------------------------------+ |
|
|
2009
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2010
|
+
| TZM Time zone minute. |
|
|
2011
|
+
| Example: |
|
|
2012
|
+
| +-------------------------------------------------+ |
|
|
2013
|
+
| | data formatter result | |
|
|
2014
|
+
| +-------------------------------------------------+ |
|
|
2015
|
+
| | 2016-01-06 09:08:01.000000 TZM 00 | |
|
|
2016
|
+
| +-------------------------------------------------+ |
|
|
2017
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2018
|
+
| TZR Time zone region. Equivalent to the format string |
|
|
2019
|
+
| 'TZH:TZM'. |
|
|
2020
|
+
| Example: |
|
|
2021
|
+
| +-------------------------------------------------+ |
|
|
2022
|
+
| | data formatter result | |
|
|
2023
|
+
| +-------------------------------------------------+ |
|
|
2024
|
+
| | 2016-01-06 09:08:01.000000 TZR +00:00 | |
|
|
2025
|
+
| +-------------------------------------------------+ |
|
|
2026
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2027
|
+
| WW Week of year (1-53) where week 1 starts on the first day |
|
|
2028
|
+
| of the year and continues to the 7th day of the year. |
|
|
2029
|
+
| Example: |
|
|
2030
|
+
| +-------------------------------------------------+ |
|
|
2031
|
+
| | data formatter result | |
|
|
2032
|
+
| +-------------------------------------------------+ |
|
|
2033
|
+
| | 2016-01-06 09:08:01.000000 WW 01 | |
|
|
2034
|
+
| +-------------------------------------------------+ |
|
|
2035
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2036
|
+
| W Week of month (1-5) where week 1 starts on the first day |
|
|
2037
|
+
| of the month and ends on the seventh. |
|
|
2038
|
+
| Example: |
|
|
2039
|
+
| +-------------------------------------------------+ |
|
|
2040
|
+
| | data formatter result | |
|
|
2041
|
+
| +-------------------------------------------------+ |
|
|
2042
|
+
| | 2016-01-06 09:08:01.000000 W 1 | |
|
|
2043
|
+
| +-------------------------------------------------+ |
|
|
2044
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2045
|
+
| X Local radix character. |
|
|
2046
|
+
| Example: |
|
|
2047
|
+
| +-------------------------------------------------+ |
|
|
2048
|
+
| | data formatter result | |
|
|
2049
|
+
| +-------------------------------------------------+ |
|
|
2050
|
+
| | 2016-01-06 09:08:01.000000 MMXYY 01.16 | |
|
|
2051
|
+
| +-------------------------------------------------+ |
|
|
2052
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2053
|
+
| Y,YYY Year with comma in this position. |
|
|
2054
|
+
| Example: |
|
|
2055
|
+
| +-------------------------------------------------+ |
|
|
2056
|
+
| | data formatter result | |
|
|
2057
|
+
| +-------------------------------------------------+ |
|
|
2058
|
+
| | 2016-01-06 09:08:01.000000 Y,YYY 2,016 | |
|
|
2059
|
+
| +-------------------------------------------------+ |
|
|
2060
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2061
|
+
| YEAR Year, spelled out. S prefixes BC dates with a minus sign.|
|
|
2062
|
+
| SYEAR |
|
|
2063
|
+
| Example: |
|
|
2064
|
+
| +-------------------------------------------------+ |
|
|
2065
|
+
| | data formatter result | |
|
|
2066
|
+
| +-------------------------------------------------+ |
|
|
2067
|
+
| | 2016-01-06 09:08:01.000000 YEAR TWENTY SIXTEEN| |
|
|
2068
|
+
| +-------------------------------------------------+ |
|
|
2069
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2070
|
+
| YYYY |
|
|
2071
|
+
| SYYYY 4-digit year. S prefixes BC dates with a minus sign. |
|
|
2072
|
+
| Example: |
|
|
2073
|
+
| +-------------------------------------------------+ |
|
|
2074
|
+
| | data formatter result | |
|
|
2075
|
+
| +-------------------------------------------------+ |
|
|
2076
|
+
| | 2016-01-06 09:08:01.000000 YYYY 2016 | |
|
|
2077
|
+
| +-------------------------------------------------+ |
|
|
2078
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2079
|
+
| YYY Last 3, 2, or 1 digit of year. |
|
|
2080
|
+
| YY If the current year and the specified year are both in |
|
|
2081
|
+
| Y the range of 0-49, the date is in the current century. |
|
|
2082
|
+
| Example: |
|
|
2083
|
+
| +-------------------------------------------------+ |
|
|
2084
|
+
| | data formatter result | |
|
|
2085
|
+
| +-------------------------------------------------+ |
|
|
2086
|
+
| | 2016-01-06 09:08:01.000000 YY 16 | |
|
|
2087
|
+
| +-------------------------------------------------+ |
|
|
2088
|
+
+--------------------------------------------------------------------------------------------------+
|
|
2089
|
+
"""
|
|
2090
|
+
# Validate formatter_type
|
|
2091
|
+
if formatter_type not in [None, "NUMERIC", "DATE", "CHAR"]:
|
|
2092
|
+
raise ValueError(
|
|
2093
|
+
"formatter_type must be one of 'NUMERIC', 'DATE', 'CHAR' or None."
|
|
2094
|
+
)
|
|
2095
|
+
if formatter_type is None:
|
|
2096
|
+
formatter = (
|
|
2097
|
+
numeric_formatters
|
|
2098
|
+
+ "\n\n"
|
|
2099
|
+
+ date_formatters
|
|
2100
|
+
+ "\n\n"
|
|
2101
|
+
+ char_formatters
|
|
2102
|
+
+ "\n\n"
|
|
2103
|
+
)
|
|
2104
|
+
elif formatter_type == "NUMERIC":
|
|
2105
|
+
formatter = numeric_formatters
|
|
2106
|
+
elif formatter_type == "DATE":
|
|
2107
|
+
formatter = date_formatters
|
|
2108
|
+
elif formatter_type == "CHAR":
|
|
2109
|
+
formatter = char_formatters
|
|
2110
|
+
print(formatter)
|