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
13
votes
4 answers

Create array of associative arrays

I want to create an array of associative arrays in a while loop. In each iteration of the while loop I want to add a new element in the array. How I can do that? After that I want to pass this array in a foreach and print the data. I have this part…
anna
  • 745
  • 2
  • 9
  • 30
12
votes
4 answers

jQuery: When creating a new element, do I need the ending tag?

var $div = $('
').appendTo($('#header')); When creating new elements and adding them to the DOM, do you need the ending tag? why or why not? Do I only need the ending tag if i'm placing content into the tag i'm creating? like…
android.nick
  • 11,069
  • 23
  • 77
  • 112
12
votes
2 answers

How to append a row to another dataframe

I have dataframes df1 and df2 both with columns ["Ticker", "Adj.Factor", "Date"]. I want to add to df2 the complete row from df1 if the value of "Adj.Factor" in that row in df1 equals to 0. I have the following code. for x in range(tot_len): if…
Ironman10
  • 237
  • 1
  • 3
  • 10
12
votes
2 answers

Why doesn't .append() method work on strings, don't they behave like lists?

Why does this statement produce an error even though a string is actually a list of character constants? string_name = "" string_name.append("hello word") The reason I expect this to work is because when we use for-loop, we are allowed to use…
Piyush Kumar
  • 153
  • 1
  • 2
  • 10
12
votes
3 answers

Thymeleaf:

I'm trying to append some text to a dynamic text as shown below: But the UI throws: TemplateProcessingException: Could not parse as expression: "Hello ${worldText} Does anyone know how can I achieve…
Vasudev
  • 803
  • 1
  • 7
  • 16
12
votes
5 answers

how to append an element to a list without keeping track of the index?

I am looking for the r equivalent of this simple code in python mylist = [] for this in that: df = 1 mylist.append(df) basically just creating an empty list, and then adding the objects created within the loop to it. I only saw R solutions…
ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235
12
votes
3 answers

jQuery click on appended elements

I have generated some html links with jQuery and appended it to some div but it seams that i can't call click method now, when these elements are appended (it worked ok when they were hardcoded into html) $('#something a').click(function() ... Does…
Dejan
  • 207
  • 1
  • 3
  • 6
12
votes
2 answers

parsing a dictionary in a pandas dataframe cell into new row cells (new columns)

I have a Pandas Dataframe that contains one column containing cells containing a dictionary of key:value pairs, like this: {"name":"Test Thorton","company":"Test Group","address":"10850 Test #325\r\n","city":"Test…
r_g_r
  • 121
  • 1
  • 1
  • 5
12
votes
6 answers

Groovy way to conditionally append to a String

Good old java way to conditionally append something to string is as follows: if (booleanFlag) { myString += "something to append" } Can I do the same in more groovy way, ideally in one line?
Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
12
votes
6 answers

How to add an element at the end of an array?

I want to know how to add or append a new element to the end of an array. Is any simple way to add the element at the end? I know how to use a StringBuffer but I don't know how to use it to add an element in an array. I prefer it without an…
Jeffrey Zong
  • 123
  • 1
  • 1
  • 7
12
votes
5 answers

Python - appending to a pickled list

I'm struggling to append a list in a pickled file. This is the code: #saving high scores to a pickled file import pickle first_name = input("Please enter your name:") score = input("Please enter your score:") scores = [] high_scores = first_name,…
Charlie
  • 123
  • 1
  • 1
  • 7
12
votes
2 answers

jQuery autocomplete for dynamically created inputs

I'm having an issue using jQuery autocomplete with dynamically created inputs (again created with jQuery). I can't get autocomplete to bind to the new inputs. Autocomplete $("#description").autocomplete({ source: function(request,…
Jamatu
  • 248
  • 1
  • 3
  • 7
12
votes
1 answer

D3.js .append( ) on existing

According to my code, it looks like key_square and key_line divisions should be sibling elements to key_row since I am appending them to the division "key", but they are descendants of key_row. Could someone explain this to me? Thank you, …
user3562812
  • 1,751
  • 5
  • 20
  • 30
12
votes
3 answers

How to append to a json object in angular js

I am having an object like this $scope.releases = [{name : "All Stage",active:true}]; I need to append more data to it [ {name : "Development",active:false}, {name : "Production",active:false}, {name : "Staging",active:false} ] So the final…
Sajith
  • 2,842
  • 9
  • 37
  • 49
12
votes
4 answers

Perl - Append to last line of a file (onto same line)

Can someone let me know how to append an output file's last entry based on the current value? E.g. I am generating an output .txt file, say: a b c d 10 With some processing I get value 20 and now I want that value to be assigned and aligned with…
Amit Moses Albert
  • 123
  • 1
  • 1
  • 5