Neha Wadhwa
Neha Wadhwa

Reputation: 1

Insert selected rows from one Sframe to another Sframe

I am aware of append() function to append all rows of one SFrame to another. But I want to insert a specific row from one SFrame to anaother. Is there a way to pick say only 2nd row from Sframe1 and append it to SFrame2?

Structure of Promocodes sheet:
Column 1:Item_Code
Column 2: Item_Name



import graphlab
import pandas as pd
tc = graphlab.SFrame('Totalcodes.csv')
pc = graphlab.SFrame('Promocodes.csv')

for row in tc:
  me = graphlab.SFrame({'Item_Code': [row['Item_Code']],'Item_Name': [row['Item_Name']]})
  pc = pc.append(me)

I want to pick single row from tc and append it to pc

Upvotes: 0

Views: 485

Answers (1)

Eduardo Santos
Eduardo Santos

Reputation: 1

https://turi.com/products/create/docs/generated/graphlab.SFrame.append.html

sf = graphlab.SFrame({'id': [4, 6, 8], 'val': ['D', 'F', 'H']})
sf2 = graphlab.SFrame({'id': [1, 2, 3], 'val': ['A', 'B', 'C']})
sf = sf.append(sf2)
sf

Upvotes: -2

Related Questions