LoginSignup
5
3

More than 1 year has passed since last update.

teradatamlデータフレームから基本統計量を出力する

Last updated at Posted at 2022-11-28

Teradata® Package for Python Function Reference [リリース番号:17.10 リリース日付:2022/4]の翻訳です。

はじめに

PythonでVantageテーブルの基本統計量を出力します。
ライブラリとしてteradatamlを利用します。

teradatamlはTeradata Vantage用のPythonライブラリです。

基本操作

Vantageに接続する

python code
# 接続用ライブラリの宣言
import teradataml as tdml
# データベース接続
tdml.create_context(host = "IPアドレス",username='ユーザ名',password='パスワード')

テーブルを指定してデータを取得する

# Customerテーブルのデータをteradatamlデータフレームに読み込む
teradataml_iris = tdml.DataFrame.from_table("iris_table")

基本統計量の出力

python code
teradataml_iris.describe()
結果を表示
      sepallength sepalwidth petallength petalwidth     idx
func                                                       
min           4.3          2           1         .1       0
std          .828       .436       1.765       .762  43.445
25%           5.1        2.8         1.6         .3   37.25
50%           5.8          3        4.35        1.3    74.5
75%           6.4        3.3         5.1        1.8  111.75
max           7.9        4.4         6.9        2.5     149
mean        5.843      3.057       3.758      1.199    74.5
count         150        150         150        150     150

Vantageから切断する

python code
# データベース切断
tdml.remove_context()

おわりに

警告
この本書はTeradata Vantageドキュメンテーションよりトピックに必要な情報を抜粋したものです。掲載内容の正確性・完全性・信頼性・最新性を保証するものではございません。正確な内容については、原本をご参照下さい。
また、修正が必要な箇所や、ご要望についてはコメントをよろしくお願いします。

Teradata Vantageへのお問合せ

Teradata Vantage へのお問合せ

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3