what is pandas dataframe code example
Example 1: create a dataframe python
import numpy as np
import pandas as pd
vect1=np.zeros(10)
vect2=np.ones(10)
df=pd.DataFrame({'col1':vect1,'col2':vect2})
Example 2: dataframein python
import pandas as pd
data = {'First Column Name': ['First value', 'Second value',...],
'Second Column Name': ['First value', 'Second value',...],
....
}
df = pd.DataFrame (data, columns = ['First Column Name','Second Column Name',...])
Example 3: pandas in python
If you use Anaconda then it is preinstalled
otherwise: pip install pandas
import pandas as pd
pd.__version__
Example 4: pd dataframe
df = pd.DataFrame ({"x": x_array, "y": y_array})