Python Adding Matrix with Variables in Jupyter Notebook

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Matrix Variables
Click For Summary
To create a new SFrame with two columns and 11 rows from a list of selected words and their corresponding counts, the user is seeking guidance on initializing a new SFrame in Python. The current approach involves iterating through the 'selected_words' list to calculate the total count for each word using a sum function. However, the user is unsure how to properly create the new SFrame or alternative data structures. Suggestions for constructing the SFrame and efficiently organizing the word counts are needed, focusing on the correct methods for SFrame creation in the context of the user's existing code.
WWGD
Science Advisor
Homework Helper
Messages
7,771
Reaction score
12,990
i All,
I have a Jupyter Python Notebook with data like below:
\
upload_2016-12-5_17-9-31.png


I want to create an SFrame with 2 columns and 11 rows.Each row has two entries:
One containing the name of each word and the other entry containing the total count of the word. The words are part of a list called 'Selected Words' . I am kind of clueless,
I know how to create new columns for an existing SFrame, but no clue for how to create a new SFrame, or some other Python Data Structure. The best I have is :

for word in selected_words:
count[word]=products[word].sum()
print [word, count[word]]

Any Ideas?
Thanks.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 12 ·
Replies
12
Views
9K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K