27 lines
498 B
Python
Executable File
27 lines
498 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# I am also learning pandas, so some of this may be trivial
|
|
|
|
import numpy as np
|
|
import pandas as pd
|
|
|
|
#converting back and forth between pandas series and numpy arrays
|
|
|
|
s = pd.Series([1,3,5,np.nan,6,8])
|
|
s2 = np.array(s)
|
|
|
|
print(s)
|
|
print(s2)
|
|
|
|
s3 = pd.Series(s2)
|
|
|
|
print(s3)
|
|
|
|
# https://pandas.pydata.org/docs/user_guide/10min.html
|
|
|
|
dates = pd.date_range("20130101",periods=6)
|
|
data = np.random.randn(6,4)
|
|
df = pd.DataFrame(data,index=dates,columns=["a","b","c","ddd"])
|
|
print(df)
|
|
|