I am extracting 2 columns from 2 different CSV with panda and I would like to print the 2 columns extracted.
I have no problems printing out each column separately, but when I want to print the 2 columns inline, it returns NaN values instead of float.
To be clearer, here's the code:
import pandas as pd
col_list = ["ID",]
df = pd.read_csv("waterproofposters.csv", usecols=col_list)
col_list = ["Regular price",]
dg = pd.read_csv("tempwaterproofposters.csv", usecols=col_list,)
dh = pd.DataFrame((df)|(dg))
print (df)
Output:
ID
0 23770.0
1 23771.0
2 23772.0
3 23773.0
4 23774.0
print (dg)
Output:
Regular price
0 25.79
1 40.19
2 55.19
3 69.59
print (dh)
Output:
ID Regular price
0 NaN NaN
1 NaN NaN
2 NaN NaN
3 NaN NaN
4 NaN NaN
Wanted output:
ID Regular price
0 23770.0 25.79
1 23771.0 40.19
2 23772.0 55.19
3 23773.0 69.59
4 23774.0 NaN or null