Questions tagged [append]

To append is to join or add on to the end of something.

Append is an operation usually defined on 1D data structures (e.g., , , , , etc.).
The append operation adds an element to the end of the data structure, consequently, increasing its size by one.

11138 questions
19
votes
2 answers

Append unique values to an array in swift

I haven't found anything on that in Swift. Have found how to find unique values on an array, but not this. Sorry if it sounds quite basic... But I have the following array var selectedValues = [String]() And the following value that comes from a…
GuiSoySauce
  • 1,763
  • 3
  • 24
  • 37
19
votes
2 answers

pandas: Convert Series of DataFrames to single DataFrame

I have a pandas Series object with each value being a DataFrame. I am trying convert this into a single DataFrame with all of the Series values (individual DataFrame) stacked on top of each other. How can I achieve this without a loop? A toy example…
sriramn
  • 2,338
  • 4
  • 35
  • 45
19
votes
4 answers

Push elements from one array into rows of another array (one element per row)

I need to push elements from one array into respective rows of another array. The 2 arrays are created from $_POST and $_FILES and I need them to be associated with each other based on their indexes. $array1 = [ [123, "Title #1", "Name #1"], …
ticallian
  • 1,631
  • 7
  • 24
  • 34
19
votes
4 answers

jQuery append inside appended element

I have the following jQuery code which works, but it made me ponder if it were possible to do an append action on what was being appended without the need of specifying what I wanted to append to. append().append() didn't do the trick, it just put…
user888750
18
votes
2 answers

Java appending XML docs to existing docs

I have two XML docs that I've created and I want to combine these two inside of a new envelope. So I have National Weather Service... 5/19/2009
ravun
  • 1,523
  • 9
  • 27
  • 45
18
votes
5 answers

How to append an element to an array column of a Spark Dataframe?

Suppose I have the following DataFrame: scala> val df1 = Seq("a", "b").toDF("id").withColumn("nums", array(lit(1))) df1: org.apache.spark.sql.DataFrame = [id: string, nums: array] scala> df1.show() +---+----+ | id|nums| +---+----+ | a| [1]| |…
Shafique Jamal
  • 1,550
  • 3
  • 21
  • 45
18
votes
3 answers

Make Dictionary with only keys?

I need to make a dictionary containing only keys. I cannot use d.append() as it is not a list, neither setdefault as it needs 2 arguments: a key and a value. It should work as the following: d = {} add "a": d = {"a"} add "b": d = {"a", "b"} add…
MartinM
  • 191
  • 1
  • 1
  • 6
18
votes
4 answers

Array append() to return a new array

I'm working with a struct which has an array. I would like to add a new element to the array, however, the array is immutable so I can't simply append to it. Need to create a new array, append to it and then create a new structure with the extended…
Daniel
  • 3,758
  • 3
  • 22
  • 43
18
votes
4 answers

SSIS 2005: "Append rows to the destination table" is greyed out. Why?

In SQL Server 2005, Import Data (SSIS), my desire is to import a text file and have it append to an existing table. The first time through the wizard on the Column Mappings step I swear the Append rows to the destination table radio button was…
Pete Alvin
  • 4,646
  • 9
  • 39
  • 56
18
votes
5 answers

jQuery Appending an Object multiple times

I am not sure what exactly is happening here, I think the fact that the variable is a jquery object. This only appends once, my question is why? var newInput = $(''); $('#newDiv').append(newInput); $('#newDiv').append(newInput); Though this…
VIDesignz
  • 4,703
  • 3
  • 25
  • 37
18
votes
2 answers

Python 3, range().append() returns error: 'range' object has no attribute 'append'

In Python 2.7 the following works without a problem: myrange = range(10,100,10) myrange.append(200) print(my range) Output: [10,20,30,40,50,60,70,80,90,200] Conversely, in Python 3.3.4 the same code snippet returns the error: 'range' object has no…
MRJ
  • 187
  • 1
  • 1
  • 6
18
votes
4 answers

Append the same value multiple times to a list

To make my program more beautiful instead of ugly, I am trying to find a more pythonic way of adding a single value multiple times to a list. I now use a loop, but I create a variable I do not use. l = []; n = 5; v = 0.5 for i in xrange(n): …
Bsje
  • 223
  • 1
  • 2
  • 6
18
votes
7 answers

only add script to head if doesn't exist

I want to add additional scripts and styles to my site when a specific div is loaded. I start out by defining a path to either a script or stylesheet and then create an element. Hereafter I append the element to the head tag in HTML. But I would…
Corfitz.
  • 1,864
  • 3
  • 31
  • 53
18
votes
5 answers

Append several variables to a list in Python

I want to append several variables to a list. The number of variables varies. All variables start with "volume". I was thinking maybe a wildcard or something would do it. But I couldn't find anything like this. Any ideas how to solve this? Note in…
ustroetz
  • 5,802
  • 16
  • 47
  • 74
18
votes
3 answers

Append x occurrences of a character to a string in C#

What is the best/recommended way to add x number of occurrences of a character to a string e.g. String header = "HEADER"; The header variable needs to have, let's say a hundred 0's, added to the end of it. But this number will change depending on…
jorge_porto