Questions tagged [fromfile]
51 questions
1
vote
1 answer
Two implementations of Numpy fromfile?
I am trying to update some legacy code that uses np.fromfile in a method. When I try searching the numpy source for this method I only find np.core.records.fromfile, but when you search the docs you can find np.fromfile. Taking a look at these two…

Grr
- 15,553
- 7
- 65
- 85
1
vote
1 answer
Loading every nth element with numpy.fromfile
I want to create a numpy array from a binary file using np.fromfile. The file contains a 3D array, and I'm only concerned with a certain cell in each frame.
x = np.fromfile(file, dtype='int32', count=width*height*frames)
vals =…

threnna
- 51
- 1
- 7
1
vote
1 answer
Create array from text file using the input as keys
I'm sort of new to Python and I have tried to search for a solution to this.
I have two files. One with 1.573.553 integers like:
2990003032
2390058393
2390059146
2320205495
2320205497
2320206150
2320206151
2320206152
2320206153
2320206154
...
And…

greatwhitehat
- 39
- 1
- 5
1
vote
1 answer
Getting wrong zero values with numpy fromfile when reading binary files
I am trying to read a binary file with Python. This is the code I use:
fb = open(Bin_File, "r")
a = numpy.fromfile(fb, dtype=numpy.float32)
However, I get zero values at the end of the array. For example, for a case where nrows=296 and ncol=439 and…

ahoosh
- 1,340
- 3
- 17
- 31
1
vote
1 answer
Python reading X and Y values and assigning to Z specific X Y pairs
I have used python to create 2D XY plots in the past from pairs of data in a file, but now I need to create a contour plot from data I have in a file. The file looks like this:

jealopez
- 111
- 2
- 3
- 10
0
votes
1 answer
Converting malformed numpy array to int using fromfile, tofile, save and load
cutting right to the chase, here's what happened:
I accidentally saved a numpys array using .tofile() (rather than .save()). Then, I couldn't (but should have) load it using .load(), but only using .fromfile().
The problem occurred when I tried to…

user5618793
- 101
- 5
- 13
0
votes
1 answer
np.fromfile returns blank ndarray
I'm supposed to troubleshoot an open-source Python 2.7 code from GitHub that for some reason, cannot import the binary file correctly. I traced the problem to the following definition, which supposedly imports a binary file (.dat) into an ndarray…

Sergio Vicenzo
- 13
- 3
0
votes
2 answers
How to skip lines when reading a file with numpy.fromfile?
I am reading a .pksc file that contains coordinates and velocities of a large number of astronomical objects. I am doing the reading with
import numpy as np
f=open('halos_10x10.pksc')
data = np.fromfile(f,count=N*10,dtype=np.float32)
The file can…

NeStack
- 1,739
- 1
- 20
- 40
0
votes
1 answer
How save png as jpg without saving the file in dir
I'm using FromFile to get the image out of files, and it has the following error for the png's on the FromFile line:
Exception calling "FromFile" with "1" argument(s): "The given path's
format is not supported."
So, I'm trying to convert the bmp's…

Michele
- 3,617
- 12
- 47
- 81
0
votes
1 answer
Out of Memory exception while loading image to BitMap
I am working on app, that will edit images. But it crashes because of system.outofmemoryexception, when I try to load the image from disc. My RAM is pretty empty, but what I observed is, that app crashes, when the memory reach 30MB in memory. So…

Hynek Vaverka
- 11
- 2
0
votes
2 answers
Upgrading Microsoft.Bot.Builder.LanguageGeneration to 4.15.0 results in fromFile() error
Upgrading Microsoft.Bot.Builder.LanguageGeneration from 4.14.1 to 4.15.0 results in new errors about the fromFile() method. Couldn't find any solution or similar issues on the internet yet. This holds us from upgrading so any feedback is…

Jordy
- 99
- 7
0
votes
0 answers
Multiple url check from file
I would like to ask some help for the next project.
I have a txt file (myurls.txt) with many urls
(around 200).
(http:\url1.com,
Http:\urlblue.com etc etc)
These are different pages.
I would like to check these pages source codes and I wanna found…
0
votes
1 answer
How to give a dynamic file path in Image.Fromfile() in C#?
I want to change an image in WinForms based on a result.
if(x == true)
{
// Show image 1
else
{
// show image 2
I saw that I can use Image.Fromfile("Image path"). But I have to use an image path something like this @"C:\test\test1.jpg".
So, is…

Manoj_S
- 13
- 1
0
votes
1 answer
NumPy: Read binary file into existing array
Given a binary file of numerical values, I can read it in using numpy.fromfile(). This allocates a new array for the data. Say I already have an array a and I want to read into this array. I'd had to do something like
import numpy as np
size …

jmd_dk
- 12,125
- 9
- 63
- 94
0
votes
0 answers
Reading large array with numpy gives zeros
I have a large binary file (~4GB) written in 4byte reals. I am trying to read this file using numpy fromfile as follows.
data = np.fromfile(filename, dtype=np.single)
Upon inspecting data, I see that all elements are zeros. However when I read the…

Deepak Dalakoti
- 63
- 1
- 7