Skip to content

Commit

Permalink
pandas series demonstrated
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed Jan 19, 2020
1 parent a958f43 commit 610a6c8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Empty file.
23 changes: 23 additions & 0 deletions pandas/dataFrames/generation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# pandas dataframes generation using different methods

import pandas as pd
df = pd.DataFrame()
print(df)

# DataFrame using python list
df = pd.DataFrame([10,20,30,40,50,60])
print(df)

# DataFrame using pandas series

marks = pd.Series({'rakesh':56,'anuj':89,'Bhumi':90,'Jagdev':80})
age = pd.Series({'rakesh':18,'anuj':18,'Bhumi':16,'Jagdev':19})
print(marks)
print(age)

df=pd.DataFrame({'marks':marks,'age':age})
print(df)

#sorting DataFrame values using sort_value()
print(df.sort_values(by=['marks']))
print(df.sort_values(by=['marks'],ascending=False))

0 comments on commit 610a6c8

Please sign in to comment.