Python Forum
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print pandas's df
#3
(Jan-09-2017, 09:05 AM)buran Wrote: Please, use code tags in the future.
import pandas as pd web_stats={'Day':[1,2,3,4,5,6],            'Visitor':[43,34,65,56,29,76],            'Bounce Rate':[65,67,78,65,45,52]} df=pd.DataFrame(data=web_stats, columns=['Day', 'Visitor', 'Bounce Rate']) print(df.head())
Output:
Day Visitor Bounce Rate 0 1 43 65 1 2 34 67 2 3 65 78 3 4 56 65 4 5 29 45

Thanks.

I am curious why we have to specify the order in "df=pd.DataFrame(data=web_stats, columns=['Day', 'Visitor', 'Bounce Rate'])".

In C++ or Matlab, array data are ordered as we typed.
Reply


Messages In This Thread
print pandas's df - by landlord1984 - Jan-09-2017, 08:03 AM
RE: print pandas's df - by buran - Jan-09-2017, 09:05 AM
RE: print pandas's df - by landlord1984 - Jan-09-2017, 09:14 AM
RE: print pandas's df - by wavic - Jan-09-2017, 09:28 AM
RE: print pandas's df - by buran - Jan-09-2017, 09:41 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020