For data analysis in Python, most of the tutorials are about numpy, then about Dataframe, and then about reading files. But when I was reading the book, the first two chapters were really dizzy, so let's start our Python data analysis by reading the file.
import pandas as pd zhuanti = pd.read_csv(open('C:/Users/luopan/Desktop/xiaozhu.csv', encoding='utf-8')) zhuanti
import pandas as pd zhuanti1 = pd.read_csv(open('C:/Users/luopan/Desktop/xiaozhu.csv', encoding='utf-8'), index_col=0) zhuanti1
import pandas as pd zhuanti2 = pd.read_csv(open('C:/Users/luopan/Desktop/xiaozhu.csv', encoding='utf-8'),index_col=0,header=None) zhuanti2
import pandas as pd zhuanti3 = pd.read_csv(open('C:/Users/luopan/Desktop/xiaozhu.csv',encoding='utf-8'),skiprows=[1,2],index_col=0) zhuanti3
import pandas as pd test = pd.read_excel('C:/Users/luopan/Desktop/test.xlsx',sheetname='Sheet2',header=None) test
import pandas as pd import pymysql conn = pymysql.connect(host='localhost', user='root', passwd='123456', db='test', port=3306, charset='utf8') jianshu = pd.read_sql('select * from jianshu1',conn) jianshu
import pandas as pd import pymongo client = pymongo.MongoClient('localhost',port = 27017) test = client['test'] tieba = test['tieba'] data = pd.DataFrame(list(tieba.find())) data