Trouble Creating Dataframe from Arrays
I want to create a DataFrame with separate columns for PY and ST, however the DataFrame is created with index values of PY.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
K = 8000
ST = np.linspace(7000,9000,num=50)
PO = 50
PY = np.maximum(ST-K-PO,0)
pd.DataFrame(PY,ST)
Is there a way to create the DataFrame with default index starting from 0 and 2 columns of PY and ST.
You can use df = pd.DataFrame(list(zip(PY,ST)),columns=["py","st"])