I don't understand this error... I've already turned df into lowercase before turning it into a list
all_cols0 who is your hero and why1 what do you do to relax2 this is a hero4 how many hours of sleep do you get a night5 describe the last time you were relax
from sklearn.cluster import MeanShiftfrom sklearn.pipeline import Pipelinefrom sklearn.preprocessing import FunctionTransformerfrom sklearn.feature_extraction.text import TfidfVectorizerdf['all_cols'] = df['all_cols'].str.lower()df_list = df.values.tolist()pipeline = Pipeline(steps=[('tfidf', TfidfVectorizer()),('trans', FunctionTransformer(lambda x: x.todense(), accept_sparse=True)),('clust', MeanShift())])pipeline.fit(df_list)pipeline.named_steps['clust'].labels_result = [(label,doc) for doc,label in zip(df_list, pipeline.named_steps['clust'].labels_)]for label,doc in sorted(result): print(label, doc)
But I have an error in this line:
AttributeError Traceback (most recent call last) in
----> 1 pipeline.fit(df_list)
AttributeError: 'list' object has no attribute 'lower'
But why is the program returning a lowercase error if I've already passed the lowercase dataframe before?
I am currently trying to work with text data and I am relatively new at this. The column I'm trying to work with is the cast column, as shown below:
0 [Sam Worthington, Zoe Saldana, Sigourney Weave...1 [Johnny Depp, Orlando Bloom, Keira Knightley, ...2 [Daniel Craig, Christoph Waltz, Léa Seydoux, R...3 [Christian Bale, Michael Caine, Gary Oldman, A...4 [Taylor Kitsch, Lynn Collins, Samantha Morton,...Name: cast, dtype: object
What I want is to lower all the upper cases. However when I try to do it, it converts everything to NaN values.
Here's the simple thing I've done:
Here's the output:
0 NaN1 NaN2 NaN3 NaN4 NaN5 NaN6 NaN7 NaN8 NaN9 NaN10 NaN11 NaN12 NaN13 NaN14 NaN15 NaN16 NaN17 NaN18 NaN19 NaN20 NaN21 NaN22 NaN23 NaN24 NaN25 NaN26 NaN27 NaN28 NaN29 NaN ..
Can anyone help me understand what I'm doing wrong and how I could potentially fix it? Thank you for your time!!!
I need to know if there is a function that detects the lowercase letters in a string. Say I started writing this program:
s = input('Type a word')
Would there be a function that lets me detect a lowercase letter within the string s? Possibly ending up with assigning those letters to a different variable, or just printing the lowercase letters or number of lowercase letters.
While those would be what I would like to do with it I'm most interested in how to detect the presence of lowercase letters. The simplest methods would be welcome, I am only in an introductory python course so my teacher wouldn't want to see complex solutions when I take my midterm. Thanks for the help!
I am trying to run a query using Eloquentthe $vars['language'] is in lower case but the language column is not necessarily in lower case. How can i do this search using eloquent but still have the lower case in the query
What i want to do is this even though i can't find anywhere how to do this
so that they are both in lowercase and then i can get them to match.
I've just compiled the version MySQL 8.0.12 in a Ubuntu 16.0.4.
After following the instructions in the website and making the following my.cnf file:
[mysqld]datadir=/usr/local/mysql/datasocket=/tmp/mysql.sockport=3306log-error=/usr/local/mysql/data/localhost.localdomain.erruser=mysqlsecure_file_priv=/usr/local/mysql/mysql-fileslocal_infile=OFFlog_error = /var/log/mysql/error.log# Remove case sensitive in table nameslower_case_table_names=1
I get the following error:
2018-08-11T19:45:06.461585Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('1') and data dictionary ('0').
What should I change so that data dictionary is aligned to server settings?