基础知识:如果你要取前几行a=c[0:3,:] 前0,1,2行
b = c[0,2:4] 第0行的第2和第3列不包括第4列,因为列下标也是从0开始的
d = c[2:4,2:4] 取中间的2-4行的2-4列
e = c[0,:] 取第0行所有数据
f = c[:,1] 取第1列所有数据
g = c[::2,::2] 两个冒号后面表示步长为2
问题描述:有一个文本文件,8000*5,获取其中每一列数据1.打开文件;2.利用pands.read_XXX读取; 3.获取某行或者某列数据
# -*- coding:utf-8 -*-
import tensorflow as tf
import numpy as np
import pandas as pd
import os
#load .csv
f=open("D:/code/ml/DataIO/welldata.txt")
df=pd.read_table(f,nrows=4) #读取
print("type of df",type(df))
value=df.values
print("type of value:",type(value))
print("shape of value:",value.shape)
print(value[:,1]) #读取某一列的数据
type of df <class 'pandas.core.frame.DataFrame'>
type of value: <class 'numpy.ndarray'>
shape of value: (4, 5)
[ 2.617 2.554 2.467 2.508]python之Pandas文本数据读取和写入
https://blog.youkuaiyun.com/Vinsuan1993/article/details/79972319
Python科学计算:读取txt,csv,mat文件https://blog.youkuaiyun.com/xierhacker/article/details/53201308
本文介绍了如何使用numpy进行数组操作,包括选取指定行和列的方法:如a=c[0:3,:]获取前3行;b=c[0,2:4]获取第0行的第2和第3列;d=c[2:4,2:4]获取2-4行的2-4列;e=c[0,:]取第0行所有数据;f=c[:,1]取第1列所有数据;g=c[::2,::2]以步长2选取行和列。"
80829523,7809512,使用JMeter进行SOAP协议的并发接口测试,"['jmeter', 'soap', '并发', '接口测试']
750

被折叠的 条评论
为什么被折叠?



