LoginSignup
0
0

More than 1 year has passed since last update.

Series データ・インデックスのみを取り出す

Posted at

概要

作成したSeriesのデータ値のみ、インデックス値のみを取り出す方法がある。
データ値の場合は、.valuesとし、インデックスの場合は、 .indexとする。

import pandas as pd
fruits = ["apple", "orange", "banana", "straberry", "kiwifruit"]
data = [10, 5, 1, 2, 3]

series = pd.Series(data, index = fruits)

#データ値
series_values = series.values
print(series_values )
print()

#インデックス値
series_index = series.index
print(series_index)

データ値の出力

image.png

インデックス値の出力

image.png

0
0
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
0
0