Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Concat the data frames correctly [closed]

$
0
0

How do I concat train and test data if on the test one column is not present but I still want to keep that column present since my code doesnt work

test_df['sales'] = float('nan')

combined_df = pd.concat([train_df, test_df], axis=0)

test_df['sales'] = float('nan')

combined_df = pd.concat([train_df, test_df], axis=0)

I was expecting the sales from the train data not to be 0 as well but the whole sales column is 0 now


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>