Questions tagged [py-datatable]

Use this tag for questions related to the `datatable` python library. Consider tagging your questions with [python] as well. Do not use this tag to ask questions about generic "tables of data".

Datatable is a python library for manipulating two-dimensional data tables (called Frames). It is similar in spirit to python pandas and R data.table.

108 questions
2
votes
1 answer

datatable assign month from date column

I'm trying to assign a month number from the date column (with a subset based on on another column): base = datetime.datetime.today() date_list = [base - datetime.timedelta(days=x) for x in range(10)] DT1 = dt.Frame(A = date_list, B = range(10)) I…
Rafael
  • 3,096
  • 1
  • 23
  • 61
2
votes
1 answer

assign new columns to datatable

How do I assign new columns to a datatable? Tried this: DT1 = dt.Frame(A = range(5)) DT1['B'] = [1, 2, 3, 4, 5] But getting ValueError: The LHS of the replacement has 1 columns, while the RHS has 5 replacement expressions
Rafael
  • 3,096
  • 1
  • 23
  • 61
2
votes
3 answers

How do I select all columns excluding one (or two) from a datatable in python

In R data.table, I can exclude columns like so library(data.table) foo <- data.table(x = c(1,2,3), y = c(4, 5, 6), z = c(7, 8, 9)) print(foo) x y z 1: 1 4 7 2: 2 5 8 3: 3 6 9 # exclude one column foo[, !"x"] y z 1: 4 7 2: 5 8 3: 6 9 #…
Ben
  • 20,038
  • 30
  • 112
  • 189
2
votes
1 answer

Apply user-defined functions over a python datatable (not pandas dataframe)?

Datatable is popular for R, but it also has a Python version. However, I don't see anything in the docs for applying a user defined function over a datatable. Here's a toy example (in pandas) where a user function is applied over a dataframe to look…
AdmiralWen
  • 701
  • 6
  • 16
2
votes
3 answers

python datatable, string manipulation on column

from datatable import dt, f, g, by, update, join, sort tt = dt.Frame({'a' : ['A1','A2','A3'], 'b':[100,200,300]}) print(tt) | a b -- + -- --- 0 | A1 100 1 | A2 200 2 | A3 300 [3 rows x 2 columns] How can I remove the 'A' in the a…
jf328
  • 6,841
  • 10
  • 58
  • 82
2
votes
3 answers

How to deselect row(s) at specific indices in pydatatable?

I have a datatable as below, | season title rating -- + ------ --------------------- ------ 0 | 10 The last one 9.7 1 | 1 The pilot 5.6 2 | 4 The one where estelle 7.8 3 | …
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
2
votes
1 answer

Pydatatable enumerate rows within each group

Given the following datatable DT = dt.Frame({'A':['A','A','A','B','B','B'], 'B':['a','a','b','a','a','a'], }) I'd like to create column 'C', which numbers the rows within each group in columns A and B like this: A…
Zappageck
  • 122
  • 9
2
votes
2 answers

How to pass in the f expression column to a function when extending the dataframe in pydatatable?

I'm trying to generate some random data and keep it in a datatable, for this reason I have created a custom function as: def make_data(nrows): DT = dt.Frame({'x': 5*np.random.normal(size=nrows)}) DT_EX = DT[:,f[:].extend({'y': 0.01*f['x']…
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
2
votes
1 answer

How to remove a list of columns from pydatatable dataframe?

I have a datatable Frame created as: comidas_gen_dt = dt.Frame({ 'country':list('ABCDE'), 'id':[1,2,3,4,5], 'egg':[10,20,30,5,40], 'veg':[30,40,10,3,5], 'fork':[5,10,2,1,9], 'beef':[90,50,20,None,4]}) I have created a custom…
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
2
votes
1 answer

How to create a pydatatable dataframe from a dictionary which has unequal values across keys?

I'm trying to implement a functionality converting longer columns to widers columns in pydatatable, in this process i have come across an issue with dictionary which has different sizes each key as demonstrated in the below code. long_to_wide_dict =…
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
2
votes
2 answers

change type of columns in python Datatable

Is it possible to change the stypes.int8 to stypes.int32 in python datatable?
rahram
  • 560
  • 1
  • 7
  • 21
2
votes
1 answer

How do deselect columns from pydatable frame?

I have a datatable frame with about 30 columns, here I wanted to look at only 26 cols by keeping the remaining 4 columns a side in Frame, would the unary operator be useful to deselect the columns as follows DT[:,-(f.x)] I have tried it but it's…
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
2
votes
1 answer

How to build dev version of python datatable on macos (getting pip._vendor.pep517.wrappers.BackendUnavailable)

Following the directions on the datatable page https://datatable.readthedocs.io/en/latest/install.html So I ran this: $pip3 install git+https://github.com/h2oai/datatable The result is : Collecting git+https://github.com/h2oai/datatable …
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
2
votes
2 answers

Column Names faint or invisible for python Datatable view() on MacOS

I'm giving the H2O datatable a try and am intrigued by the view() feature. It looks like a handy way to navigate a dataset: The navigator is great: you can use g2000 to go to row 2000 . But the column headers are faint - almost invisible. The…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
2
votes
1 answer

How to drop duplicates in a python datatable h2oai

The datatable package in python (https://github.com/h2oai/datatable/) can count the number of unique values in a column, Is there a way to drop the duplicates values with this package or I have to use the slow pandas package?
rahram
  • 560
  • 1
  • 7
  • 21