I am new to machine learning. Please can you help me out? from below warning
My Code
df1 = pd.DataFrame(df.Keywords_List.str.split(' ', 1).tolist(), columns=['Subject', 'Keyword'])
df2 = pd.DataFrame(df1.Keyword.str.split('(', 1).tolist(), columns=['Keyword', 'Count'])
Error
FutureWarning: In a future version of pandas all arguments of StringMethods.split except for the argument 'pat' will be keyword-only.
df1 = pd.DataFrame(df.Keywords_List.str.split(' ', 1).tolist(), columns=['Subject', 'Keyword'])
FutureWarning: In a future version of pandas all arguments of StringMethods.split except for the argument 'pat' will be keyword-only.
df2 = pd.DataFrame(df1.Keyword.str.split('(', 1).tolist(), columns=['Keyword', 'Count'])
CodePudding user response:
Looking at the call signature,
split(self, pat=None, n=-1, expand=False)
you are supplying the n
parameter as a positional arguement. This is a warning. It works now, but will fail in the future. To get rid of the warning, make it a named parameter
df.Keywords_List.str.split(' ', n=1)
CodePudding user response:
The console is printing a warning that the .split() your using in your code will require all arguments to be keyword only. You currently have "split(' ', 1)" in your code, and should work fine at the moment. When this change takes place, you will have to type in "split(' ', n=1). Below are the keywords for .split().
Series.str.split(pat=None, n=- 1, expand=False, *, regex=None)