共 40 篇文章 |
|
plt.plot(df[''''''''Mes''''''''], df[''''''''data science''''''''], label=''''''''data science'''''''')plt.plot(df[''... 阅1 转自老三的休... 公众公开 24-05-03 12:14 |
阅7 转0 评0 公众公开 24-01-17 17:30 |
list1 = [1, 2, 3, 4, 5]list2 = [2, 3, 4]set1 = set(list1)set2 = set(list2)list3 = list(set1.symmetric_difference(set2))print(list3)计算对象正在使用的内存。list1 = [1, 1, 2, 2, 3, 4, 5]list2 = list(set(list1))print(list2)列表中的所有元素是否相同。list1 = [1, 2, 3, 4]list2 = [''''''''one&... 阅2 转0 评0 公众公开 24-01-12 10:34 |
示例代码:示例代码:from twisted.internet import reactordef hello_world(): print(''''''''Hello, World!'''''''') reactor.stop()reactor.callWhenRunning(hello_world)reactor.run()14. Pygame.示例代码:import cv2image = cv2.imread(''''''... 阅7 转1 评0 公众公开 24-01-11 15:27 |
我整理了100个Pandas常用的函数,分别分为6类:统计汇总函数、数据清洗函数、数据筛选、绘图与元素级运算函数、时间序列函数和其他函数。import pandas as pdimport numpy as npimport matplotlib.pyplot as plt #使用 matplotlib 仅仅是用来 show 图片df = pd.read_csv(''''''''forestfires.csv''... 阅6 转0 评0 公众公开 24-01-11 14:21 |
#使用数据帧方法df[(df.age >=25) &(df.address == ''''''''Hanoi'''''''')] #使用query函数df.query(''''''''age >= 25 &address == ''''''''Hanoi''''''''... 阅1 转0 评0 公众公开 24-01-11 14:05 |
总结100个Pandas中序列的实用函数。其他函数import numpy as npimport pandas as pdnp.random.seed(112)x = pd.Series(np.random.randint(8,18,6))print(x)# 对x中的元素做一阶差分print(x.diff())# 对x中的元素做降序处理print(x.sort_values(ascending = False))y = pd.Series(np.random.randint(8,16,100))# 将y中的元素做排重处理,并转换... 阅7 转0 评0 公众公开 24-01-10 19:07 |
别这样直接运行python命令。尤其是一些初学者将网上的Python软件包、代码下载的到本地~/Downloads文件夹后,就直接在此路径下运行python命令,这样做会给电脑带来极大的隐患。前面已经说过,Python只会调用系统路径、virtualenv虚拟环境路径以及当前主程序路径。如果要在下载文件夹~/Downloads中使用Python编写的工具,请养成良好习惯,使用pip... 阅1 转0 评0 公众公开 24-01-10 19:06 |
close()删除(Delete)dsn_tns = cx_Oracle.makedsn(''''''''localhost'''''''', ''''''''1521'''''''', service_name=''''''''my_database''''''... 阅6 转0 评0 公众公开 24-01-09 20:17 |