Pandas常用操作以及常见tips、tricks

Pandas常用操作以及常见tips、tricks

(adsbygoogle = window.adsbygoogle || []).push({}); 常用操作 读数据 1.读csv df = pd.read_csv("data.csv") 2.读数据库 import MySQLdb from pandas import DataFrame from pandas.io.sql import read_sql db = MySQLdb.connect(host="localhost", # your host, usually localhost user="root", # your username passwd="password", # your password db="dbname") # name of the data base query = "SELECT * FROM tablename" df = read_sql(query, db)