Python Forum
Creating new column with a input string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating new column with a input string
#3
(Apr-14-2021, 07:38 AM)supuflounder Wrote: The code you are showing and the code that produced the error message are not the same code. For example, the error is shown on line 10, but that line is line 14 in the source you show. So there is no way to know what is going on. Make sure that the code and the output you get correspond.

As I read the code, you are using TextBlob-style operations on a string. This makes no sense. If you wanted to
inputSentence ['TextBlob_Subjectivity'] =  inputSentence['inputSentence'].apply(getSubjectivity)
then inputSentence must be a TextBlob, which it is not. The error message is correct. You are trying to subscript a string using an invalid subscript.

Yes, this code was written part by part in jupyter notebook, i had rearranged for it to post. for the record, Sentiment analysis definition is a separate code, which is throwing error when calling it at run time "sentiment_analysis(sentence)".
Reply


Messages In This Thread
RE: Creating new column with a input string - by drunkenneo - Apr-14-2021, 08:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using string input for boolean tronic72 3 687 Nov-01-2023, 07:48 AM
Last Post: Gribouillis
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,122 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  Creating a numpy array from specific values of a spreadsheet column JulianZ 0 1,114 Apr-19-2022, 07:36 AM
Last Post: JulianZ
  NaN when creating a new column... Menthix 2 1,171 Mar-15-2022, 08:40 AM
Last Post: Menthix
Big Grin General programming question (input string)[ jamie_01 2 1,591 Jan-08-2022, 12:59 AM
Last Post: BashBedlam
Photo Creating column in python based on the other colums value count Bartek635 2 2,921 Apr-15-2021, 03:47 PM
Last Post: Bartek635
  Python win32api keybd_event: How do I input a string of characters? JaneTan 3 3,801 Oct-19-2020, 04:16 AM
Last Post: deanhystad
  Creating local variables from a string peckjonk 2 2,154 Feb-15-2020, 06:07 PM
Last Post: ndc85430
  How to print the 2nd column of a searched string in a csv ptey07 2 2,021 Jan-11-2020, 11:25 AM
Last Post: ptey07
  input string split Eric7Giants 3 2,998 Nov-13-2019, 07:19 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020