Error in sort.list(y) : invalid input 'Eldon Imàge® Series Desk Accessories, Clear' in 'utf8towcs' - logistic-regression

I'm still a newbie in R and I have ran logistic regression model with the below code and the error in the title appeared.Please help
code
logit_model <- glm(train_data$Returns ~ .,
data=train_data,
family =binomial (link="logit"))

No worries fam,the error was that one of the columns had a long name in it.Logistic regression could not execute,maybe it was length issue

The error is related to encoding, check this word "Imàge®", it has Unicode characters.

Related

percent encode out of range exception

I have a problem with percent.encode() in package:convert/convert.dart package.
I have an API that is used by the Arabs and can contain Arabic characters. One of the Arabic characters is "خ" and if I want to convert it with this method percent.encode('خ'.codeUnits). The code unit number is 1582 which represents 0x62e in hexadecimal. In this case, I will get an exception because it's out of range of the bytes that this library can convert. and I have this exception Unhandled Exception: FormatException: Invalid byte 0x62. Can you please help me with my problem? are there any alternatives I can use?
I have found a solution, I've used Uri.encodeQueryComponent(data). It did the trick.
[Update 1]
There is an alternative way
percent.encode(utf8.encode('خ'))

UnicodeDecodeError Sentiment140 Kaggle

I am trying to read the Sentiment140.csv available on Kaggle: https://www.kaggle.com/kazanova/sentiment140
My code is this one:
import pandas as pd
import os
cols = ['sentiment','id','date','query_string','user','text']
BASE_DIR = ''
df = pd.read_csv(os.path.join(BASE_DIR, 'Sentiment140.csv'),header=None, names=cols)
And it gives me this error:
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position
80-81: invalid continuation byte
The things I would like to understand are:
1) How do I solve this issue?
2) Where can I see which type of encoding should I use instead of "utf-8", based on the error?
3) Using other encoding methods will cause me other issues later on?
Thanks in advance
P.s. I am using python3 on a mac
This works:
https://investigate.ai/investigating-sentiment-analysis/cleaning-the-sentiment140-data/
Turns out encoding="latin-1" and you have to specify column names, otherwise it will use the first row as column names. This is how lousy real-world dataset can be haha

Altova Mapforce- Could not find start of message error

I am using Altomava Mapforce to map and load 837 x12 formatted text files directly to Sql Server 2014. I have correctly mapped everything except I get the following errors-
Missing field F142- Application Senders code
Could not find start of message with impl.convention reference '116731H333B2'. Message will be skipped.
Missing segment GE
I have included my header and footer information below from the original source text file. Does anyone know what is going on with the mapping, or if maybe there is something wrong with the data itself? Any help would be greatly appreciated.
Header-
ISA*11* *11* *PP* *ZZ*20121143 *273041*0109*^*00501*000000000*0*T*:~GS*HC**211231153*20141121*1115*01*Y*116731H333B2~ST*837*2000001*116731H333B2~BHT*0029*00*0003000005*20141121*1115*CH
Message Data etc.......
Footer-
~SE*769*2000001~GE*1*01~IEA*1*000000000~
Your data is wrong. Here is a cleaned up version of the ISA / GS. For readability, I put a CR/LF after the segment terminator (~). Please note the ISA and GS do not indicate sender, which is going to cause all kinds of problems for auditing. See my comment above for analysis on the data per your bullet points.
ISA*11* *11* *PP*SENDER *ZZ*20121143 *273041*0109*^*00501*000000000*0*T*:~
GS*HC*SENDER*211231153*20141121*1115*01*X*005010~
ST*837*2000001*116731H333B2~
BHT*0029*00*0003000005*20141121*1115*CH
An example of the enveloping:
ISA*00* *00* *ZZ*Test1Saver *ZZ*RECEIVER *151222*1932*U*00501*000111884*0*P*:~GS*HC*Test1Saver*RECEIVER*20151222*1932*1*X*005010~ST*850*0001~
...
~SE*8*0001~GE*1*1~IEA*1*000111884~
If, 123456789 have value then map 123456789 and if having null or blank or no value then send default 123.
enter image description here

how to use arima.rob

does anyone use arima.rob() function described by Eric Zivot and Jiahui Wang in { Modelling Financial Time Series with S-PLUS } ?
I have a question about it:
I used a dataset of network traffic flows that has anomaly, and I tried to predict the last part of dataset by robust ARIMA method (Arima.rob() function) .I compare this model with arima.mle of S-PLUS. But Unexpectedly, arima.rob’s prediction did not better than that.
I’m not sure my codes are correct and may be the reason of fault is my codes.
Please, help me if I used Arima.rob inappropriately?
tmp.rr<-arima.rob((tmh75)~1,p=2,d=1,q=2,freq=24,maxiter=4,max.fcal=80000)
tmp.for<-predict(tmp.rr,n.predict=10,newdata=df1,se=T)
plot(tmp.for,tmh75)
summary(tmp.for)
my code for classic arima:
`model <- list(list(order=c(2,1,2)),list(order=c(3,1,2),period=24))
fith <- arima.mle(tmh75-mean(tmh75),model=model)
foreh <- arima.forecast(tmh75,n=25,model=fith$model)
tsplot(tmh75,foreh$mean,foreh$mean+foreh$std.err,foreh$mean-foreh$std.err)
`

Display result GeoQuerySet

I'm trying to query my PostGis database thanks to geoDjango but I have an error where I found no solution on the internet.
close_loc=PlanetOsmPoint.objects.get(way__distance_lte=(lePoint, D(**distance_from_point)))
Whatever I try on the result (close_loc) with a print, I have this error :
django.db.utils.DatabaseError: Only lon/lat coordinate systems are supported in geography.
I tried to convert it to a correct format thanks to transform(SRID) but nothing was solved, still the same problem.
Here's some informations :
Transformation :
sr1=SpatialReference('54004')
sr2=SpatialReference('NAD83')
ct=CoordTransform(sr1, sr2)
What I'm doing after getting the close_loc :
close_loc.transform(ct)
print close_loc[0]
close_loc type is GeoQuerySet.
How can I exploit this result ?
The transform() function expects an integer, not a string. The correct syntax is:
close_loc.transform( new_srid_number )
In your case, something like this:
close_loc.transform(54004)
Hope it'll work !

Resources