powerbaby IP属地:广西

文章 关注 粉丝 访问 贡献
 
共 38 篇文章
显示摘要每页显示  条
In [2]: import matplotlib.pyplot as plt虽然pandas的绘图函数能够处理许多普通的绘图任务,但如果需要自定义一些高级功能的话就必须学习matplotlib API。matplotlib中的Figure还支持一种MATLAB式的编号架构(如plt.figure(2))。由于根据特定布局创建Figure和subplot是一件非常常见的任务,于是便出现了一个更为方便的方法(plt.subplots),...
描述一个或多个空白符的regex是\s+:view sourceprint?1.In [100]: import re2. 3.In [101]: text = "foo bar\t baz \tqux"4. 5.In [102]: re.split(''\s+'', text)6.Out[102]: [''foo'', ''bar'', ''baz'', ''qux'']调用re.split(''\s+&#...
view sourceprint?DataFrame({''food'':[''bacon'', ''pulled pork'', ''bacon'', ''Pastrami'', ''corned beef'', ''Bacon'', 02.In [59]: data[np.abs(data) >3] = np.sign(data) * 302.In [81]: genres = sorted(set....
使用SQLAlchemy.class User(Base): __tablename__ = ''user'' id = Column(String(20), primary_key=True) name = Column(String(20)) # 一对多: books = relationship(''Book'')class Book(Base): __tablename__ = ''book'' id = Column(String(20), primary_key=True) name = Column(String...
read_sql()函数将SQL表读入DataFrame。to_csv()函数将DataFrame数据存储在指定的csv文件中。read_csv()函数将CSV文件中的数据读入DataFrame。1.存储时,CSV和SQL都默认存储行标签(index),因此需要指定存储行标签列的名字,index_label。2.读取时,CSV和SQL都需要指定哪一列是行标签(index)列,index_col,不同的是CSV是通过列的序号指定,...
DataFrame(np.array([ [''a'', 5, 9], [''b'', 4, 61], [''c'', 24, 9]]), columns=[''name'', ''attr11'', ''attr12''])df2 = pd.DataFrame(np.array([ [''a'', 5, 19], [''b'', 14, 16], [''c...
ACOS Vector Trigonometric ACosASIN Vector Trigonometric ASinATAN Vector Trigonometric ATanCEIL Vector CeilCOS Vector Trigonometric CosCOSH Vector Trigonometric CoshEXP Vector Arithmetic ExpFLOOR Vector FloorLN Vector Log NaturalLOG10 Vector Log10SIN Vector Trigonometric SinSINH Vector Trigonometric SinhSQRT Vector Squ...
当一个新数组用整型数组索引创建时,新数组有相同的形状,而不是整数数组:a = np.array([1, 2, 3, 4])b = np.array([4, 2, 2, 4])c = np.array([1, 2, 3, 4])np.array_equal(a, b)a = np.ones((4, 5))a[0] = 2 # 我们将一个数组的纬度0分配给另一个数组的纬度1a.x = np.linspace(0, 1, 20)y = np.cos(x) + 0.3*np.random.rand(20)p = np.poly1...
1.4Matplotlib:绘图。import numpy as npX = np.linspace(-np.pi, np.pi, 256, endpoint=True)C, S = np.cos(X), np.sin(X)pl.axes([0, 0, 1, 1])N = 20theta = np.arange(0., 2 * np.pi, 2 * np.pi / N)radii = 10 * np.random.rand(N)width = np.pi / 4 * np.random.rand(N)bars = pl.bar(theta, radii, width=width, bottom=0.0)for r, bar...
df[''one'']df.one。df.iloc[行位置,列位置]df.iloc[1,1]#选取第二行,第二列的值,返回的为单个值df.iloc[0,2],:]#选取第一行及第三行的数据df.iloc[0:2,:]#选取第一行到第三行(不包含)的数据df.iloc[:,1]#选取所有记录的第一列的值,返回的为一个Seriesdf.iloc[1,:]#选取第一行数据,返回的为一个Series。df.ix[1,1]df.ix[...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部