Files
training.python.datascience/source/pandas/01-pandas-manual/05-series-index.py

15 lines
409 B
Python

import pandas as pd
if __name__ == '__main__':
df = pd.Series([1, 3, 2, 4, 2, 2, 2, 1, 1, 3])
# Add an index to the series, that could be used to make a
# temporal series.
df.index = pd.Series([2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
print(df)
s = pd.Series([2, 5, 2, 6], index=pd.date_range("2023-01-01", "2023-01-10", 4))
print(s)
dr = pd.date_range("2023-01-01", "2023-01-10", 4)
print(dr)