我在result.csv文件中有以下数据,我需要绘制成线图.
ColA ColB
93 46
94 56
95 66
97 76
100 86
103 96
110 106
Run Code Online (Sandbox Code Playgroud)
我拥有的是什么
from numpy import genfromtxt
import matplotlib.pyplot as plt
per_data=genfromtxt('result.csv',delimiter=','
plt.xlabel ('x stuff')
plt.ylabel ('y stuff')
plt.title('my test result')
plt.show()
Run Code Online (Sandbox Code Playgroud)
如何将每列数据输入图表并查看其趋势?每列因新数据而每天都会增长的大小.
尝试使用python matplotlib做一个图:但继续得到以下waring消息:
"UserWaring: tight_layout: falling back to Agg renderer warnings.warn("tight_layout: falling back to Agg renderer")
Run Code Online (Sandbox Code Playgroud)
我的代码如下:
plt.legend(loc='upper left',prop = {'size':7},bbox_to_anchor=(1,1))
plt.tight_layout(pad=7)
plt.xlabel ('Build')
plt.ylabel ('Time/Sec')
plt.title ('Performance Test')
plt.grid()
plt.show()
Run Code Online (Sandbox Code Playgroud)
我有一个csv文件,需要转换为HTML格式.我知道python pandas可以做到DataFormat.to_html(),但无法弄清楚放在()中的值.我有:
pd.DataFrame.to_html(class=myfile.csv)
Run Code Online (Sandbox Code Playgroud)
但是有问题.有人有想法吗?
我有这个代码:
f1=open('test.txt','r')
d={}
line = f1.read().replace('\n',' ')
line2= line.split("\n")
Run Code Online (Sandbox Code Playgroud)
line = "This is line1\nthis isline2\nthis is line3"
我的问题是:我可以使用多个分隔符进行分割,而不是先替换,然后再进行分割吗?
我有这个代码:
class A(object):
def __init__(self):
print " A"
class B(A):
def __init__(self):
print "B"
x=B()
print "Done"
Run Code Online (Sandbox Code Playgroud)
结果是:"B"被打印为什么它不打印"A",尽管B类继承A
我正在尝试从我的 csv 数据文件制作图表。我的代码如下:
for name in per_data.dtype.names[2:]:
plt.plot(per_data['RELEASE'],per_data[name],label=name)
plt.legend(loc='upper left',prop = {'size':7},bbox_to_anchor=(1,1))
plt.tight_layout(pad=5)
plt.xlabel ('Release')
plt.ylabel ('Time/Sec')
plt.title ('Ingest Performance Test')
plt.grid()
plt.show()
Run Code Online (Sandbox Code Playgroud)
我的csv数据是:
DATE RELEASE 10GB 100GB 200GB 400GB 600GB 800GB 1000GB
5/5/16 2.67 0.36 4.18 8.54 18 27 38 46
5/5/16 2.68 0.5 4.24 9.24 18 27 37 46
5/6/16 2.69 0.32 4.3 9.18 19 29 37 46
5/6/16 2.7 0.35 4.3 9.3 19 28 37 46
5/6/16 2.71 0.3 4.18 8.18 16 24 33 41
Run Code Online (Sandbox Code Playgroud)
如您所见,我使用第二列 -- …