Comments (6)
I'm not sure off the top of my head, I'll have to look up the Pandas reindex function to remember how it works. I'll get back to you in a couple of days.
Maybe you could describe to me the behavior you'd like to see in DataForge?
from data-forge-ts.
i implement this function by using javascript, i don't know am i do it right, but it work.
i find that the DataFrame.at() is very slow to get a row of data.
`dataForge.DataFrame.prototype.reindex = function(new_index, fill_value = null) {
let newArray = ["tempIndex"].concat(this.getColumnNames());
let pairs = this.toPairs();
let newIndexArray = new_index.toArray();
const dfIndexArray = this.getIndex().toArray();
const filterPairs = pairs.reduce(function(a, e, i) {
if (newIndexArray.indexOf(e[0]) >= 0) {
let obj = e[1];
let idx = e[0];
let newObj = {};
newArray.forEach(val => {
if (val === "tempIndex") {
newObj[val] = idx;
} else {
newObj[val] = obj[val];
}
});
a.push(newObj);
}
return a;
}, []);
const emptyPairs = newIndexArray.reduce(function(a, e, i) {
if (dfIndexArray.indexOf(e) === -1) {
let newObj = {};
newArray.forEach(val => {
if (val === "tempIndex") {
newObj[val] = e;
} else {
newObj[val] = fill_value;
}
});
a.push(newObj);
}
return a;
}, []);`
from data-forge-ts.
Reindex won't make at
any faster.
Currently at
doesn't even use the index. I'll re-write the function at some point so that uses the index.
from data-forge-ts.
@ashleydavis as you mentioned at
doesn't use index, what is the function which uses index to return the row?
from data-forge-ts.
@ashleydavis Or is it already rewritten as i can see in the docs?
https://github.com/data-forge/data-forge-ts/blob/master/docs/guide.md#getting-a-row-or-value-by-index
from data-forge-ts.
The at function takes an index and returns the first value at that index.
The at function is not optimised, so it is quite slow (this can be fixed of course),
from data-forge-ts.
Related Issues (20)
- 'withSeries' of DataFrame not working correctly after filtering by 'where' HOT 2
- Rolling window with select function not behaving correctly HOT 4
- What am I missing? (inconsistent math when generating a new column) HOT 3
- Console logs in construction DataFrame HOT 3
- Tyopescript compatible new column / generateSeris HOT 1
- Data frame case sensitivity is not carried over after Merge Transform is applied HOT 3
- How to stringify entire table without boiler plate content HOT 2
- Case Sensitivity Bug in Several Transforms HOT 1
- do we have resample function similar in Pandas? HOT 1
- Can data-forage-ts transpose index and columns? HOT 1
- DataFrame distinct with multiple columns in the selector is not working if the name of the columns is variable HOT 4
- Bug on the Series toArray method removing all the null values HOT 2
- Explode functionallity HOT 3
- Improve documentation for `DataFrame.concat` in relation to index HOT 5
- Columns are badly formatted HOT 5
- Pivot seems to not respect lazy evaluation HOT 2
- getColumns(), getColumnNames(), hasSeries() don't see all columns if df is loaded fromJson() HOT 3
- merge() results in concat if index is a Date object HOT 3
- generateSeries() on a df with duplicated index uses last row results for the given index value HOT 2
- fromCSV : TypeError: row.map is not a function HOT 2
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 data-forge-ts.