Basic Data Handling Functions in Python using pandas library #Python #Python #Introduction to Python

 

# import pandas library
import pandas as pd

# read the online file by the URL provides above, and assign it to variable “df”
path=”https://……”

df = pd.read_csv(path,header=None)
print(“Done”)

# show the first 5 rows using dataframe.head() method
df.head(5)

# create headers list
headers = [“name”, “price”, “make”]

#show the list

headers

df.columns = headers

#show top 10 rows
df.head(10)

df.dropna(subset=[“price”], axis=0)

df.columns

 

Data Formate Read Save
csv pd.read_csv() df.to_csv()
json pd.read_json() df.to_json()
excel pd.read_excel() df.to_excel()
hdf pd.read_hdf() df.to_hdf()
sql pd.read_sql() df.to_sql()

 

dataframe.dtypes

 

# check the data type of data frame “df” by .dtypes
df.dtypes

df.describe()

# describe all the columns in “df”
df.describe(include = “all”) From: http://sitestree.com/?p=12204
Categories:Python, Python, Introduction to Python
Tags:
Post Data:2018-04-25 15:12:47

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada