Panda's power....in PYTHON

 

The Power of Pandas: Python

Image for post

Pandas Basics

Image for post
Image for post
In [1]: import pandas as pd

■Creating data

In [2]: pd.DataFrame({'Yes': [50, 21], 'No': [131, 2]})
Image for post
Image for post
In [3]: pd.DataFrame({'Bob': ['I liked it.', 'It was awful.'], 'Sue': ['Pretty good.', 'Bland.']})
Image for post
Image for post
Image for post
In [4]: pd.Series([1, 2, 3, 4, 5])Out [4]: 
0 1
1 2
2 3
3 4
4 5
dtype: int64

■Reading data files

Image for post
In [5]: pd.head()

■ Other Useful Tricks

In [6]: import os
In [7]: os.getcwd()
In [8]: pd.shape
Out [8]: (2200, 15)
In [9]: pd_new = pd.rename(colums = {'Amount.Requested': 'Amount.Requested_NEW'})  
In [10]: pd_new.head()
df.to_csv("filename.csv", index = False)
df.to_excel("filename.xlsx", index = False)
df.to_csv("file_name.csv", index=False)
df.to_csv("file_name.csv")
df_new = pd.read_csv("file_name.csv").drop(['unnamed 0'],axis=1)
Image for post

Comments

Popular posts from this blog

3 Tools and 2 Commands to Improve Your Git Workflow

Visual studio for MAC😎

Database profiling with Visual code