np一些基本操作1】的更多相关文章

import numpy as nparr1 = np.arange(32).reshape(8,4)print(arr1)arr1 = arr1.reshape(-1);print(arr1)arr2 = np.logspace(1,8,8,base=2).reshape(8,1)print(arr2)##数组广播的规律,要么两个维度相同,要么某一个维度为1##矩阵积为dot A np的行乘以B np的列的和,所以行列要一致.arr3 = [[15930.2,244.2], [8111.87,…
##生成一个一维数组import numpy as np;nb7 = np.arange(0,100,2);print(nb7)print("========================================")##将一维数组转化为两个数组nb7.shape = (2,-1)print(nb7)print("========================================")##等差数列 0到10之间取五个数做等差数列nb8=np.li…
DataFrame是Pandas中的一个表结构的数据结构,包括三部分信息,表头(列的名称),表的内容(二维矩阵),索引(每行一个唯一的标记). 一.DataFrame的创建 有多种方式可以创建DataFrame,下面举例介绍. 例1: 通过list创建 >>> import pandas as pd >>> df = pd.DataFrame([[1,2,3],[4,5,6]]) >>> df 0 1 2 0 1 2 3 1 4 5 6 [2 rows…
本文记录matlibplot常用基本操作,都是基本功能,不涉及复杂联合操作,其中各用法详细用法可参考官网: 1. 基本画图操作 ##mofan_matplotlib.pyplot import matplotlib.pyplot as plt import numpy as np x = np.linspace(1,50) y = 2*x + 1 #draw the lines #plt.plot(x,y) #show to draw the figure :must call at the l…
转自:Laumians博客园 更简明易懂看Matplotlib Python 画图教程 (莫烦Python)_演讲•公开课_科技_bilibili_哔哩哔哩 https://www.bilibili.com/video/av16378354/#page=1 plt.plot(x,y , fmt)  :绘制坐标图 plt.boxplot(data, notch, position): 绘制箱形图 plt.bar(left, height, width, bottom) : 绘制条形图 plt.ba…
这些操作在网上都可以百度得到,为了便于记忆自己再根据理解总结在一起.---------励志做一个优雅的网上搬运工 1.建立dataframe (1)Dict to Dataframe df = pd.DataFrame({'key1':['a','a','b','b','a'],'key2':['one','two','one','two','one'],'data1':np.random.randn(5),'data2':np.random.randn(5)}) df data1 data2…
pandas学习(一) Pandas基本数据结构 Series类型数据 Dataframe类型 基本操作 Pandas基本数据结构 两种常用数据结构: Series 一维数组,与Numpy中的一维array类似,二者与Python基本数据结构List很相似,Series能保存不同数据类型,字符串,boolbean值.数字等都能保存在Series中 DataFrame 二维的表格型数据结构.很多功能与R中的data frame类似.可以将DataFrame理解为Series的容器. Series类…
Python数据分析库pandas基本操作2017年02月20日 17:09:06 birdlove1987 阅读数:22631 标签: python 数据分析 pandas 更多 个人分类: Python第三方库 所属专栏: python第三方库 pandas是什么? 是它吗?....很显然pandas没有这个家伙那么可爱....我们来看看pandas的官网是怎么来定义自己的:pandas is an open source, easy-to-use data structures and d…
怎样删除list中空字符? 最简单的方法:new_list = [ x for x in li if x != '' ] 这一部分主要学习pandas中基于前面两种数据结构的基本操作. 设有DataFrame结果的数据a如下所示: a b c one 4 1 1 two 6 2 0 three 6 1 6 一.查看数据(查看对象的方法对于Series来说同样适用) 1.查看DataFrame前xx行或后xx行a=DataFrame(data);a.head(6)表示显示前6行数据,若head()…
一.常量的定义 import tensorflow as tf #类比 语法 api 原理 #基础数据类型 运算符 流程 字典 数组 data1 = tf.constant(2,dtype=tf.int32) data2 = tf.Variable(10,name='var') print(data1) print(data2) #shape 维度 const长度 shape维度 dtype 数据类型 sess = tf.Session() print(sess.run(data1)) init…