❮ Previous Next ❯

Data Frame Introduction


Data frame is a main object in pandas. It is used to represent with rows and columns(tabular or excel spreadsheet like data).


D_F_Output1
How to create a data frame.

Hi frnds, here I have used jupyter notebook environment

import pandas as pd

abc_web={'Day':[1,2,3,4,5,6,7],'Visitors':[1000,2000,3000,4000,5000,6000,7000],'Bounse_Rate':[10,20,30,25,35,26,36]}

df=pd.DataFrame(abc_web)

print(df)


Output
D_F_Output1

Here we have a dictionary named abc_web, simply we converted this dictionary to data frame. Now we can perform slicing operation. Suppose from the above output we want to see from starting 2 rows, then we write;

print(df.head(2))
D_F_Output2

If we want to see last 2 rows of data then we write

print(df.tail(2))
D_F_Output3


❮ Previous Next ❯

Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved