Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanu-N-Prabhu authored May 8, 2019
1 parent 9a6ed50 commit 5170287
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/panda_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pandas as pd
import numpy as np

# There are three datastructures in panda
# 1. Series ==> They are a 1-D Matrix
# 2. DataFrame ==> They are a 2-D Matrix
# 3. Panel ==> They are a 3-D Matrix


# Creating a Series Datastructure
a = [1, 2, 3, 4, 5]
series = pd.Series(a)
print(series)

# Creating the Dataframe Datastructure
b = [['Ashika', 24], ['Tanu', 23], ['Ashwin', 22],['Mohith', 16], ['Sourabh', 10]]
dataframe = pd.DataFrame(b, columns= ['Name', 'Age'], dtype= int)
print(dataframe)

# Creating the Panel Datastructure
data = {'Item1' : pd.DataFrame(np.random.randn(4, 3)),
'Item2' : pd.DataFrame(np.random.randn(4, 2))}
p = pd.Panel(data)
print(p.minor_xs(1))

0 comments on commit 5170287

Please sign in to comment.