[PYTHON] pandas series part 1

Series is a one-dimensional data structure.

1


import pandas as pd

series = pd.Series([3, 6, 9])
print(series)

Execution result of 1


0    3
1    6
2    9
dtype: int64

There is an index in the leftmost column.

To change the index, write as follows

2


import pandas as pd

names = ["Tanaka", "Yamada", "Takahashi"]

series1 = pd.Series(names)
series2 = pd.Series(names, index=['a', 'b', 'c'])

print(series1)
print(series2)

Execution result of 2


0 Tanaka
1 Yamada
2 Takahashi
dtype: object
a Tanaka
b Yamada
c Takahashi
dtype: object

Recommended Posts

pandas series part 1
Python application: Pandas Part 2: Series
Python application: Pandas Part 1: Basic
Most wanted pandas functions (Part 02)
Pandas
Time series analysis part 4 VAR
Time series analysis Part 3 Forecast
Time series analysis Part 1 Autocorrelation
[Python] How to use Pandas Series
Excel aggregation with Python pandas Part 1
datetime part 1
Pandas memo
numpy part 1
argparse part 1
Pandas basics
Time series analysis Part 2 AR / MA / ARMA
Pandas notes
Python application: Pandas Part 4: DataFrame concatenation / combination
Excel aggregation with Python pandas Part 2 Variadic
Pandas memorandum
Pandas basics
numpy part 2
pandas memorandum
pandas memo
Adding Series to columns in python pandas
pandas SettingWithCopyWarning
[Python learning part 3] Convert pandas DataFrame, Series, and standard List to each other
Convenient time series aggregation with TimeGrouper in pandas
Basic operation of Python Pandas Series and Dataframe (1)