Comments (6)
Another example to consider is saving a frequency sheet as .fixed
. For example, suppose you have colours.csv
:
colours
blue
blue
blue
green
green
green
green
orange
purple
red
red
The Frequency sheet looks like this:
If you save it as fixed, you get:
colours count percent histogram
green 4 36.36 ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
blue 3 27.27 ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
red 2 18.18 ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
orange 1 9.09 ▇▇▇▇▇▇▇▇▇
purple 1 9.09 ▇▇▇▇▇▇▇▇▇
Once again, there are three extra spaces inserted. However, because the count and percent are numeric, they are right-aligned. Due to the right-alignment, the three extra spaces are added on the left side of the numeric values, which causes them to not be aligned with the column headers. This breaks the fixed loader:
from visidata.
Most recent fixed width saver issue: #1849
from visidata.
from visidata.
Hmm... I'm wondering if getMaxWidth
is being used for conflicting purposes. Here, we want the max width of the data, but it looks like getMaxWidth
is trying to get a max display width. Also, I'm wondering if this is where the extra spaces come from:
Line 472 in 6424f63
from visidata.
I've added a draft PR with some experimentation. (#2257) It's a lot closer to what I expect. It separates columns by a single space. However, when reading, that space is still interpreted as data, so we still grow by a single space per round trip. I think the saver is good to go, but the loader needs some work to prevent it loading the column separation space as data. I also switched it to use the real max width, rather than the max width of the window. This will be slow, but I think it's OK, because it will only run when saving, and I think most people would want to save all the data without truncating it.
from visidata.
The PR above is ready for initial review.
from visidata.
Related Issues (20)
- Cannot open xpt files with the latest xport dependency version HOT 2
- AttributeError: `AttrColumn` object has no attribute `column_letter` HOT 1
- The expression used for custom columns using `=` is evaluated repeatedly HOT 2
- [eml] Add an alias for mhtml file type that maps to eml
- [eml] Traceback when using the x command to extract entries without a filename HOT 1
- Can't disable mouse HOT 2
- vd v3.0.2 performance regression on Android HOT 1
- [Windows] Error: use_default_colors() returned ERR HOT 1
- system crash opening large (compressed) file
- unable to edit nested json value
- shell-command-on-cell HOT 1
- vdsql: edit cell, copy as sql, dump data...
- `history` parameter of input() is appears ignored HOT 1
- Support Decimal type HOT 1
- vsdql related errors on load and `&`
- Can't open any file HOT 2
- Scientific notation shown for column with large number even when type is string HOT 2
- [texttables] incorrect 'tabulate' module installed with brew HOT 6
- Autodetect file delimiters by scanning the first ten lines HOT 1
- Some issues during first time testing vdsql HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from visidata.