Comments (2)
my current solution is extending the rc.DataFrame:
class DataFrame(rc.DataFrame):
def __init__(self, series_list=None): # series_list is a list of rc.Series
all_index = set()
#data = {}
columns = []
for series in series_list:
all_index |= set(series.index)
columns.append(series.id)
index = sorted(all_index)
super(DataFrame, self).__init__(index=index, columns=columns)
for i in index:
data = {}
for series in series_list:
if i in series.index:
data[series.id] = series[i]
self.set(indexes=i, values=data)
any better solution?
from raccoon.
I don't think there is an elegant way to do this right now. Using the native functionality if you know you only have one column then this works:
import raccoon as rc
df1 = rc.DataFrame(data={'close': [9,8,7,6]}, index=[0,2,4,6], sort=True)
df2 = rc.DataFrame(data={'open': [1,2,3,4,5,6,7]}, index=[0, 1, 2, 3, 4, 5, 6], sort=True)
df1.set(df2.index, df2.columns[0], df2.data[0])
df1.show()
index close open
------- ------- ------
0 9 1
1 2
2 8 3
3 4
4 7 5
5 6
6 6 7
If you have more than one column you could just run a loop that repeats the above for each column
from raccoon.
Related Issues (10)
- Start
- Introduction of Blosc as alternative array backend instead of blist HOT 6
- The python code in the README is not rendering HOT 4
- Question: does raccoon use the e.g. the bisect functions from the dropins? HOT 2
- Implement this DataFrame interchange protocol
- Make .values return a copy and rename to .data
- Python 2 support? HOT 8
- Bug in set_column index check HOT 1
- Custom sort keys / ordering HOT 6
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 raccoon.