-
-
Save garymanley/d4700cf63458f34e5362bba0f9c6c2f3 to your computer and use it in GitHub Desktop.
Pandas Basics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu Dec 28 19:46:45 2017 | |
@author: garym | |
""" | |
#import pandas | |
import pandas as pd | |
## create dataframe from csv | |
dataframe = pd.read_csv(r'C:\Users\garym\Documents\PyWinAutoBlog\File\testing.csv') | |
## can also use from sql, html, txt, excel etc. | |
## print top 5 row | |
print(dataframe.head(5)) | |
#Rename columns | |
dataframe.columns = ['Start', 'Bob', 'Colx', 'Something','Woo', 'testing'] | |
print(dataframe.head(5)) | |
#Drop Columns | |
dataframe.drop(['Start', 'Bob'], axis = 1 , inplace = True) | |
print(dataframe.head(5)) | |
#Get Unique values | |
dfUnique = dataframe.Colx.unique() | |
print(dfUnique) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment