ZacAttack ZacAttack - 1 month ago 10
Python Question

How do i get my columns to display side by side in the command promt when running python code?

I am curious if their is a way to display my columns of data right beside each other instead of 7 columns and then the remaining columns below.

This is the output

aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg \
1 1 2 3 4 5 6 7
2 1 2 3 4 5 6 7
3 1 2 3 4 5 6 7

hhhhhhhh iiiiiiii
1 8 9
2 8 9
3 8 9
Press any key to continue . . .


This is the code

import pandas as pd

df = pd.DataFrame(index=['1','2','3'])

df['aaaaaaaa'] = 1
df['bbbbbbbb'] = 2
df['cccccccc'] = 3
df['dddddddd'] = 4
df['eeeeeeee'] = 5
df['ffffffff'] = 6
df['gggggggg'] = 7
df['hhhhhhhh'] = 8
df['iiiiiiii'] = 9



print (df.head())

Answer

Were you trying to combine two different csv files? If so you need to use the append method. DataFrame.append

Comments