0
votes
1answer
27 views

Fixed digits number in floats

I read a lot of discussion about this on SE, but still can't find the right one. I want to plot some numbers, of various lengths, with the same number of digits. For example I have: 12.345678, ...
3
votes
1answer
52 views

Python: How do I format numbers for a fixed width?

let's say numbers = [ 0.7653, 10.2, 100.2325, 500.9874 ] I'd like to output the numbers with a fixed width by varying the number of decimal places to get an output like this: 0.7653 10.200 100.23 ...
-1
votes
1answer
23 views

read a table according to a certain number of characters

I want to extract the name of comets from my table. However some comets are 1-worded, others are 2-worded, and some are 3-worded. My table looks like this: 9P/Tempel 1 1.525 ...
-1
votes
2answers
321 views

How to format string padding both sides to center it around particular point

I'm sorry, I feel like there is a better title for my question, but I can't think of it. The situation, essentially, is this: I am creating a fixed-width information table. I have a list of (k,v) ...
1
vote
0answers
278 views

Python Pandas, write DataFrame to fixed-width file (to_fwf?)

I see that Pandas has read_fwf, but does it have something like DataFrame.to_fwf? I'm looking for support for field width, numerical precision, and string justification. It seems that ...
2
votes
1answer
718 views

Python float formating: fixed total number of digits

I am saving some data with numpy.savetxt(path,array,fmt="%.2f %.2f %.2f %.2f %.2f") and I want the text file to be formated nicely. I would like to limit the floats to a certain amount of digits, like ...
0
votes
1answer
215 views

Need help in splitting a fixed-width string with unprintable characters

I have a particularly nasty fixed-width file to work with. It's not encoded in the formats I thought it would be. In a nutshell, I'm trying to do a variety of things: Skip all the whitespace before ...
1
vote
2answers
768 views

Tkinter GUI to Convert Fixed Width File to Delimited File

I am writing a converter code for our Data Department to convert fixed width files into delmited files. Normally we use import the file into Excel, use the text import wizard to set the field lengths, ...
6
votes
1answer
1k views

Excel-like text import in Python: automatically parsing fixed width columns

In Excel, if you import whitespace delineated text in which the columns do not line up perfectly and data may be missing, like pH pKa/Em n(slope) 1000*chi2 vdw0 CYS-I0014_ ...
5
votes
3answers
2k views

writing fixed width, space delimited CSV output in Python

I would like to write a fixed width, space delimited and minimally quoted CSV file using Python's csv writer. An example of the output: item1 item2 "next item1" "next item2" ...
0
votes
1answer
348 views

How to keep the width of the bars the same no matter the number of bars we compare in the figure?

I want to keep the width of the bars the same no matter the number of bars compared is high or low. I am using Matplotlib stacked bar chart. the width of the bars is relative to the number of the ...