将数据文件加载到绘图时IOError(IOError when loading data file to plot)

import matplotlib.pyplot as plt

import numpy as np

x,y = np.genfromtxt('D:\Tanjil\Python\directory\Heat Available Datas.csv',unpack=True , delimiter=',',skip_header=0)

plt.plot(x,y,'ro--'),

plt.ylabel('Power Input (kW)'),

plt.xlabel('Speed(rpm)'),

plt.show()

但是这段代码显示了这个错误信息:

File "C:\Users\bad_tanjil\Anaconda\lib\site-packages\numpy\lib\_datasource.py", line 151, in open
    return ds.open(path, mode)

  File "C:\Users\bad_tanjil\Anaconda\lib\site-packages\numpy\lib\_datasource.py", line 501, in open
    raise IOError("%s not found." % path)

IOError: D:\Tanjil\Python\directory\Heat Available Datas.csv not found.

import matplotlib.pyplot as plt

import numpy as np

x,y = np.genfromtxt('D:\Tanjil\Python\directory\Heat Available Datas.csv',unpack=True , delimiter=',',skip_header=0)

plt.plot(x,y,'ro--'),

plt.ylabel('Power Input (kW)'),

plt.xlabel('Speed(rpm)'),

plt.show()

but this code shows this error message :

File "C:\Users\bad_tanjil\Anaconda\lib\site-packages\numpy\lib\_datasource.py", line 151, in open
    return ds.open(path, mode)

  File "C:\Users\bad_tanjil\Anaconda\lib\site-packages\numpy\lib\_datasource.py", line 501, in open
    raise IOError("%s not found." % path)

IOError: D:\Tanjil\Python\directory\Heat Available Datas.csv not found.
2022-06-07 17:06

满意答案

/而不是\尝试你的路径。 这就是你指定路径的方式。 在一个字符串\作为一个转义字符。 你也可以使用\\


Try your path with / rather than \. That's how you specify the path. In a string \ acts as an escape character. You can also use \\

相关问答

更多

如何将对象加载到从R数据文件指定的变量名中?(How can I load an object into a variable name that I specify from an R data file?)

如果您只是保存单个对象,请勿使用.Rdata文件,使用.RDS文件: x <- 5 saveRDS(x, "x.rds") y <- readRDS("x.rds") all.equal(x, y) If you're just saving a single object, don't use an .Rdata file, use an .RDS file: x <- 5 saveRDS(x, "x.rds") y <- readRDS("x.rds") all.equal(x, y)

将数据从文件加载到Excel(loading data from file to excel)

我得到了对ActiveWorkbook的错误引用。 这纠正了它: 更换 ActiveWorkbook.Worksheets(1).Cells.Copy wsSheet.Range("A1") ActiveWorkbook.Close True 同 Dim wb As Workbook Set wb = ActiveWorkbook wb.Worksheets(1).Cells.Copy wsSheet.Range("A1") wb.Close True I was getting a wr...

IOError:没有这样的文件或目录:(IOError: No such file or directory:)

错误: IOError: [Errno 2] No such file or directory: '/home/sbr/aaa/test_stats_temp.dat' 表示使用working_dir设置的路径不存在。 创建目录将修复它。 The error: IOError: [Errno 2] No such file or directory: '/home/sbr/aaa/test_stats_temp.dat' Indicates that the path set with work...

如何在通过将txt文件加载到scipy程序形成的图上的特定区间内插入点?(how to interpolate points in a specific interval on a plot formed by loading a txt file in to scipy program?)

您可以使用scipy.interp1d创建一个函数: import numpy as np from scipy import interpolate data = np.genfromtxt('data.txt') x = data[:,0] #first column y = data[:,1] #second column f = interpolate.interp1d(x, y) xnew = np.arange(1, 5.1, 0.1) # this could be ov...

gnuplot循环数据文件和3D绘图的迭代器(gnuplot looping data files and an iterator for 3D plot)

使用函数来更改变量。 list = system('dir /b *.csv') f(x)=(x=x+1, x-1) x = 0 splot for [file in list] file using (f(x)):1:2 w l Use function to change variable. list = system('dir /b *.csv') f(x)=(x=x+1, x-1) x = 0 splot for [file in list] file using (f(x)):1:2 ...

将数据文件加载到绘图时IOError(IOError when loading data file to plot)

用/而不是\尝试你的路径。 这就是你指定路径的方式。 在一个字符串\作为一个转义字符。 你也可以使用\\ Try your path with / rather than \. That's how you specify the path. In a string \ acts as an escape character. You can also use \\

使用Pickle和filelock在多线程中加载和转储到文件 - IOError:[Errno 13](Load and dump to file in multithreading using Pickle and filelock - IOError: [Errno 13])

根据Filelock文档,你应该在try{}except{}包含lock.acquire, try{}except{} 。 否则,当您获得超时时,它可能会使您的应用程序因未处理的异常而崩溃。 请参阅https://pypi.python.org/pypi/filelock I have found the solution to my problem. It appears that you have to give a different lock name than the file you ...

我的语法中的错误是什么阻止我将数据文件加载到mysql中(What is the error in my syntax preventing me from loading my data file into mysql)

--local-infile是服务器和客户端参数。 它不是语句的有效语句,如LOAD DATA或INSERT语句。 您可以在my.cnf文件的相应部分中指定服务器变量和选项,或者作为正在执行的MySQL程序的命令行参数。 例如,在OS提示符下... # mysql -h myserverhost -u mysqlname -p --local-infile=1 必须为MySQL服务器指定该选项。 如果您以user @ localhost身份进行连接,则不需要LOCAL。 你可以给你想要加载的文...

限制巨大的二进制数据文件的gnuplot图(Limiting gnuplot plot of huge binary data file)

您可以使用gnuplot的每个关键字,例如绘制前2000条记录: plot 'file.dat' binary format='%float%float' every ::::2000 using 1:2 with lines; 但它似乎读取整个文件,然后只绘制前2000条记录,这可能不是你想要的。 因此,您可能必须使用外部实用程序,例如: plot "<(head --bytes 16000 file.dat)" binary format='%float%float' using 1:2 w...

使用ShinyFiles加载数据文件(Loading data files with ShinyFiles)

很难理解“Shiny似乎不使用内容”的含义 参见示例( - 我的数据中有对象“y”。) UI shinyUI( fluidPage( shinyFilesButton('file', 'Load Dataset', 'Please select a dataset', FALSE), textOutput("txt") ) ) 服务器 shinyServer(function(input, output,session) { shinyFileChoose...

相关文章

更多

(二)solr data import

solr 的 data import 导入 mysql数据 (1)、编辑 example/solr/c ...

用‘button’跟‘text’组合代替‘file’,选择文件后点‘submit’,‘file’的值被清空

各位大虾晚上好,我有个问题想请教你们,我想美化html的file外观,但貌似现在还不能用css直接设计 ...

《Big Data Glossary》笔记

清明假期翻以前的笔记发现有一些NoSQL相关的内容,比较零散,是之前读《Big Data Glossa ...

PHP 中dirname(_file_)

PHP 中dirname(_file_) 2007-5-3 16:00|查看: 19256|评论: ...

【HDFS】HADOOP DISTRIBUTED FILE SYSTEM

【HDFS】Hadoop DISTRIBUTED FILE SYSTEM THE CAST CLIEN ...

Solr 4.3.0 配置Data import handler时出错

启动solr的时候,居然出现了如下的错误: org.apache.solr.common.SolrEx ...

自己封装的一个Solr Data Import Request Handler Scheduler

经过将近一天的努力,终于搞定了Solr的Data Import Request HandlerSche ...

Becoming a data scientist

Data Week: Becoming a data scientist Data Pointed, ...

data-config

Data-config为solr的data-import处理器配置数据来源。 依次按照如下树状结构: ...

zz Data Analysis Process

An interesting article....easy to understand. Summa ...

最新问答

更多

绝地求生、荒野行动、香肠派对 哪个更好玩???(都是吃鸡类游戏)

PC上的绝地求生,是最早也是最火的大逃杀游戏。 荒野行动是网易抄袭蓝洞绝地求生制作的手游。相似度90%,还有他一起出的终结折2,这2款正在被蓝洞告,打官司呢。 手游上的绝地求生有2部都是蓝洞授权(收钱)给腾讯开发的正版ID手游。所以跟PC上做的一模一样,蓝洞也没话说。 加上吃鸡国服也是腾讯独家代理,所以根本没有什么可说的。只要这个类型的 过于相似的,腾讯都可以借蓝洞之手起诉。打压同行是国内BAT最爱干的事嘛! 香肠派对画风虽然不一样,但核心玩法还是跟人家正版的一样的,同样也是没有被授权的。 98

如何在jQuery集合中选择第n个jQuery对象?(How to select the nth jQuery object in a jQuery collection?)

你可以使用eq : var rootElement = $('.grid').find('.box').eq(0); rootElement.find('.a'); /* Use chaining to do more work */ You can use eq: var rootElement = $('.grid').find('.box').eq(0); rootElement.find('.a'); /* Use chaining to do more work */

ASP NET使用jQuery和AJAX上传图像(ASP NET upload image with jQuery and AJAX)

您可以自己手动设置FormData键和值。 Upload 创建FormData并设置新的键/值 $("#btnUpload").on("click", function(e) { e.preventDefault(); var file = $("#imguploader").get(0).file

SQL Server XML查询中包含名称空间的位置(SQL Server XML query with namespaces in the where exist)

您可能希望使用#temp.identXml.query而不是#temp.identXml.query 。 您可以在这里阅读更多相关信息SQL Server XML exists() 我相信你也可以像这样使用它 Select #temp.identXml.value('(/*:PersonIdentity/*:MasterIndexes/*:PersonIndex/*:SourceIndex)[1]','varchar(100)') as Ident ,#temp.identXml.value(

宁夏银川永宁县望远镇哪里有修mp5的?

胜利街有家电维修,电脑城,银川商场多得很…

我想用更新的日期标记所有更新的行(I would like to mark all updated rows with the date that they have been updated)

您可以使用更新后触发的触发器来执行此操作。 给出如下表: create table your_table (id int primary key, val int, last_update datetime) 每当您更新表中的内容时,此触发器将设置last_update值。 CREATE TRIGGER trigger_name ON your_table AFTER UPDATE AS BEGIN UPDATE your_table SET your_ta

郑州会计培训班

招生的,至于时间吗,就看你自己的时间段了,你可以致电0371-63300220.他们会帮你选择一下的。离你最近,最专业的培训班。

如何定位数组中的负数,并得到所有正数的总和?(How to target e negative number from an array, and get the sum of all positive numbers?)

只需创建一个条件来检查它是正数还是负数,然后定义一个空的数组negatives ,如果数字是负数,则将其推到负数组中,如果是正数,则将其添加到sum变量中,请查看下面的工作示例。 function SummPositive( numbers ) { var negatives = []; var sum = 0; for(var i = 0; i < numbers.length; i++) { if(numbers[i] < 0) { negati

在响应图像上叠加网格(Overlay grid on responsive image)

使用两个linear-gradient s,我们可以创建两个简单的线条,然后每隔n%重复一次background-size 。 它看起来像这样: background: linear-gradient(to bottom, #000 2px, transparent 2px), linear-gradient(to right, #000 2px, transparent 2px); background-size: 10%; 两个渐变创建两条相交的线,长度为百分比,如下所示: 使用默认的b

无法让POST在Azure网站上运行(Could not get POST to work on Azure Website)

最后我找到了答案......我不得不删除尾随的斜线! 我使用了“ https://example.com/api/messages/ ”,这将自动产生GET,无论我使用PostAsync还是PostAsJsonAsync。 使用“ https://example.com/api/messages”,GET和POST似乎都运行良好! Finally I've found the answer.... I had to remove the trailing slash! I've used "ht