h2oai / h2oai/datatable

create Frame object from ctypes Structure

Open
#2,216 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
164
Avg merge
7h 31m
Merged PRs (30d)
1

Description

say I have a user defined Structure, and some instances:

```
from ctypes import *

class Person(Structure):
_fields_ = [
("name", c_char * 16),
("age", c_int32),
("height", c_double),
("location", c_int32 * 2)
]

alice = Person(b"Alice", 25, 1.72, (3, 5))
bob = Person(b"Bob", 27, 1.77, (4, 3))
```

I would like to construct a Frame object like

```
f = dt.Frame([alice, bob])
print(f)
```
which would give
```
name age height location_0 location_1
0 Alice 25 1.72 3 5
1 Bob 27 1.77 4 3
```

right now, datatable will give `ValueError: Unknown format 'T{(16)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.