'What is printed when you print a pandas dataframe?

I printed my data frame and it came out looking like this:

       date eye   pct_change \cheese...    date mouse pct_change  \cat
29   29-Nov-2019          0.002555  ...          NaN               NaN
30   02-Dec-2019          0.006483  ...          NaN               NaN
31   03-Dec-2019         -0.040024  ...          NaN               NaN
32   04-Dec-2019          0.009405  ...          NaN               NaN
33   01-Jan-2020         -0.226805  ...          NaN               NaN
..           ...               ...  ...          ...               ...
758          NaN               NaN  ...  04-Dec-2019          0.002225
759          NaN               NaN  ...  01-Jan-2020          0.004440
760          NaN               NaN  ...  02-Jan-2020          0.004420
761          NaN               NaN  ...  03-Jan-2020          0.004400
762          NaN               NaN  ...  06-Jan-2020         -0.002191

[7412 rows x 20 columns]

It says the dimensions are [7412 rows x 20 columns],but on the left it lists the index from 29 to 762.



Solution 1:[1]

 df = pandas.concat([col1,col2,col3,...],axis=1,ignore_index=True)

Is probably the answer

Im operating on the assumption that you have something like

df = pandas.concat([col1,col2,col3,...]) 

which is likely stacking them on top of eachother instead of next to each other

but your columns need to all be the same height ... so maybe that throws an error ...

if they are not the same height you can make them the same height or use pandas.merge to join them on a column ... but we are getting in the weeds...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joran Beasley