Questions tagged [pad]

This tag is currently a synonym for [padding]. For other purposes, please consider [gamepad] or [ipad] or [pad-xml] instead.

Padding is the process of fitting a given data type (usually a number, image, array, or string) to a particular size by adding data to it without changing its overall meaning.

132 questions
2
votes
2 answers

How to insert "1 " in the start for a column in R?

I have a column in my data (master_data) called unit. master_data$unit <- c("Tonnes","1000 Tonnes","Numbers","1000 Numbers") I want to transform this column such that I get this master_data$unit <- c("1 Tonnes","1000 Tonnes","1 Numbers", "1000…
Sankalp Mathur
  • 119
  • 1
  • 5
2
votes
2 answers

Scatter plot do not adjust properly plot range in matplotlib

I am plotting two gaussians (one centered in 0 and the other one in 100) with plt.plot and plt.scatter in matplotlib version 2.2.3. For any reason the subplot does not adjust the plot range automatically for the case of the second curve in the…
alpelito7
  • 435
  • 2
  • 10
2
votes
1 answer

Recursively padding 0's in names of files and folders

I have a folder containing video lectures on some particular topic. It is structured like this: . ├── 1_fol │   ├── 1_file.mp4 │   ├── 2_file.mp4 │   └── 3_file.mp4 └── 2_fol ├── 10_file.mp4 ├── 4_file.mp4 ├── 5_file.mp4 ├──…
nascarsayan
  • 166
  • 3
  • 7
2
votes
2 answers

How can one pad zeroes in-between non-consecutive float elements of a sorted list that contains duplicates?

I have a list of float values that represent the time of an observation. (Each float value can actually be represented as an integer, but I am hoping to generalize for possible future circumstances). list_hrs = [4,6,8,8,10] # actual list is…
user7345804
2
votes
2 answers

Is there a simple pad in numpy?

Is there a numpy function that pads an array this way? import numpy as np def pad(x, length): tmp = np.zeros((length,)) tmp[:x.shape[0]] = x return tmp x = np.array([1,2,3]) print pad(x, 5) Output: [ 1. 2. 3. 0. 0.] I couldn't…
Yariv
  • 381
  • 3
  • 11
2
votes
2 answers

Pad Value with fix length - xslt

I have this simple xslt code:
Raul
  • 27
  • 2
  • 5
2
votes
4 answers

Left pad a Haskell list

If I wanted to right-pad a Haskell list of integers, I could do something like the following: rpad m xs = take m $ xs ++ repeat 0 There would be no need to get the length of the list. I think it would be quite performant. Is there a similar way I…
user1002430
2
votes
4 answers

Using Google Guava to format Strings

I am using Google guava to format Strings and write them to a text file using BufferedWriter import com.google.common.base.Strings; import java.io.*; public class Test { public static void main(String[] args) { File f = new…
Stanley Mungai
  • 4,044
  • 30
  • 100
  • 168
1
vote
1 answer

Padding an N-dimension Matrix with different paddings for each element in the matrix - Python

I am trying to pad two dimensions of an N-dimensional matrix with different paddings and override the values. Consider the Following example: def determineShifts(layer): u = range(0, 2*layer + 1) b = range(0, 2*layer + 1) shifts = [] …
Paddy
  • 91
  • 7
1
vote
1 answer

Gstreamer: How to link a request pad (sink) and static pad (source)

Trying to do the linking for tee to a queue. Here is what i do in the program codes Program snippets /// create the tee pad template tee_src_pad_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS…
user1538798
  • 1,075
  • 3
  • 17
  • 42
1
vote
1 answer

Fill data gaps with Pad using group returns error

I have time-series data that starts and ends during the calendar year and most fill functions (like pad, package padr) fill gaps between start and end dates. However I need a complete annual record. For example if my data start date is 2016-01-03…
DAY
  • 91
  • 6
1
vote
1 answer

pad 2d arrays in order to concatenate them

this is probably a very basic question, but i struggle to get the math right. I have a list with arrays of different sizes. The shapes look like so: (30, 300) (7, 300) (16, 300) (10, 300) (12, 300) (33, 300) (5, 300) (11, 300) (18, 300) (31,…
dumbchild
  • 275
  • 4
  • 11
1
vote
1 answer

Tmux pad format string

I want to pad a format string to a certain length. For example, the Tmux Battery plugin introduces the battery_percentage format string. I can use this in the status bar as #{battery_percentage}. The battery percentage values can be: Between 0% and…
Ameer Taweel
  • 949
  • 1
  • 11
  • 37
1
vote
0 answers

C/ncurses/pads - how to deal at the edges of a pad shown on stdscr with prefresh

I am new to c coding and trying out this and that. Recently I stumbled over ncurses and am experimenting with it. In Dan Gookin's "guide to programming with ncurses". I saw pads and their properties and functionality and now I want to archive the…
1
vote
1 answer

How to pad the sequence in tensorflow

I have a Dataset that contains ragged tensors like this: non_ragged_dataset = tf.data.Dataset.from_tensor_slices([1, 5, 3, 2, 8]) non_ragged_dataset = non_ragged_dataset.map(tf.range) batched_non_ragged_dataset = non_ragged_dataset.apply( …
s.jie
  • 53
  • 5
1 2
3
8 9