Categories
CMS Development Drupal

Calculate total numeric field entries

I am trying to find a solution for a Drupal 8 table view that I have created that outputs book ratings per author. I would like to display a table that shows the Author Name with the total number of 10.0, 9.5, 9.0, etc. ratings they have. Not the sum but the “tally” of times […]

Categories
Development

Splitting a big dataframe into multiple dataframes

I have a list of power plants and I split them in for loop and make some processes like this. list_of_pp = [v for k, v in pp_data.groupby(‘filename’)] dataframes = pd.DataFrame() for pp in list_of_pp: pp = pp.groupby([‘Date’, ‘filename’]).sum().reset_index().set_index(‘Date’).reindex(YF_date_range) pp[‘filename’] = pp[‘filename’].replace(”, np.nan).ffill().bfill() pp.fillna(0, inplace = True) dataframes = dataframes.append(pp) Output: Date filename teklifId fiyat […]

Categories
Development

Interpolate dataArray missing data using xarray

I am using xarray/rasterio to do some operations on a set of GeoTiff files. The data that I am dealing with contain missing values (-9999) at some grid points. Is there any efficient pythonic way to replace these values with interpolated data using xarray? For example I have something like: >>> da = xr.DataArray([[1.0,2.0,3.0],[4.0,-999.0,6.0],[7.0,-999.0,9.0]],[(‘x’,[1,2,3]),(‘y’,[1,2,3])]) >>> […]

Categories
Development

Group by / Drop duplicates / Sum holding

I am using JupyterLab to print some data in a spreadsheet in a specific way. I have two different files: 1) 2) For every original_id == id I want to group by country and list the brands and summing and listing the holding for each brand. The result I got with my code is this: […]

Categories
Development

Image convolution, error when getting the pixel from image

I adapted the code from RosettaCode and i’m getting the error: “Invalid coordinates” The error seems to be in the Ks value. I’m passing go get pixel a negative value. The arguments of the function were in the site. filter and get pixel functions: colorPixel getPixelRGB(ImageRGB *imageRGB,int x, int y){ if ( (x<0) || (x […]

Categories
Development

How do I convert this data to an MIDI file?

I have the Note Index (Each Octave has 12 notes) versus the time(in beats) data. How can I convert this data to a midi file? Example Data: time = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 11.0, 11.0] notes = [57.0, 59.0, 60.0, 62.0, 64.0, 65.0, 67.0, 57.0, 60.0, […]

Categories
Development

select the checkbox of a particular value the corresponding table column should hide

when I click the filter on the top right corner menu opens. in that menu it has table header values with checkboxes. when I select the checkbox of a particular value the corresponding table column should hide. so I wrote a click event for that check box but I am not sure how to pass […]

Categories
Development

can’t multiply sequence by non-int of type ‘numpy.float64’

I was programming a error back propagation NN where I have this hidden layer local gradient hl_loc_grads, learning rate parameter as eta and input_data[i] as input from csv file. Here is hl_local_grads = [0.00195312 0.00195312 0.00195312 0.00195312] with class <class ‘numpy.ndarray’> eta is 1 and Train data is [[1, 16, 10.5, 2, 1, 100, 25], […]

Categories
Development

Re-drawing 2 pyplot charts IN PLACE without re-drawing new ones

EDIT: Added import statements to make code example completely self-contained. I’m trying to UPDATE pyplot charts that have already been drawn IN PLACE, without drawing a new chart. I found this thread on the subject and I think I followed all the advice it contained, but I still can’t get it to work. That thread […]

Categories
Development

getdata() Script time out only when time-triggered

I’m importing a range from another spreadsheet and pasting it in the current spreadsheet with this script: function getdata() { var values = SpreadsheetApp.openById(‘XXXXXX’). getSheetByName(‘SheetB’).getRange(‘A4:AZ484’).getValues(); var destsheet = SpreadsheetApp.getActive().getSheetByName(‘Sheet1’); var destrange = destsheet.getRange(‘B520:BA1000’); destrange.setValues(values); } When firing the script manually the execution lasts around 20 seconds and has no problems at all: [19-09-06 23:34:48:847 PDT] […]