02 2020 档案

摘要:import pandas as pd读文件操作:data = pd.read_csv(filename[,参数列表]) 参数:常用参数: filepath_or_buffer : str,pathlib。str, pathlib.Path, py._path.local.LocalPath or 阅读全文
posted @ 2020-02-25 10:56 江大大snk 阅读(563) 评论(0) 推荐(0)
摘要:import pymysqldb = pymysql.connect('localhost', 'root', 'root', 'py123') # 本机接口,数据库账户,数据库密码,数据库名称cursor = db.cursor()# cursor.execute("create database 阅读全文
posted @ 2020-02-10 11:13 江大大snk 阅读(241) 评论(0) 推荐(0)
摘要:import requestsimport timefrom bs4 import BeautifulSoupclass getContents(): # 获取html页面 def getHTMLText(self, url): try: kv = {'user-agent': 'Mozilla/5 阅读全文
posted @ 2020-02-10 11:11 江大大snk 阅读(249) 评论(0) 推荐(0)
摘要:如何通过Python读取文本,分割符号为逗号、空格,怎么操作?with open("housing.csv") as f: f.read().split(", ")如何通过pandas读取数据read_csv(filename, name=name, sep=" ")读取数据后,如何查看数据前几行d 阅读全文
posted @ 2020-02-10 11:09 江大大snk 阅读(148) 评论(0) 推荐(0)