2018-10-22         Giles

sklearn - ValueError: could not convert string to float: 'yes'

I have a dataset which has following categorical data colname. When performing one_hot_encoding using sklearn I get an error.def ohe_encode(train, test, index): Onehot = OneHotEncoder(categorical_features='all', handle_unknown='error') x_train_1 = train x_test_1 = test colname = df.columns[index] Onehot.fit(train[colname].astype(str)) x_trans = Onehot.transform(train[columnns].astype(str)) new_features = Onehot.transform(test[colname].astype(str)) return (x_transform, new_features)error appeared on screen displaying,ValueError: could not convert stri...

 machine-learning                     1 answers                     3 view
 2018-10-22         Giles

Better way to replace values in DataFrame from large dictionary

I have written some code that replaces values in a DataFrame with values from another frame using a dictionary, and it is working, but i am using this on some large files, where the dictionary can get very long. A few thousand pairs. When I then uses this code it runs very slow, and it have also been going out of memory on a few ocations. I am somewhat convinced that my method of doing this is far from optimal, and that there must be some faster ways to do this. I have created a simple example that does what I want, but that is slow for large amounts of data. Hope someone ...

 python-3.x                     1 answers                     31 view
 2018-10-22         Giles

FormatException of DateTime.Parse. Check which part is wrong in my date string

I'd like to validate a date string in my TextBox.If I have 2018-06-07 string in my TextBox, I can parse it with success with DateTime.TryParse or DateTime.Parse.But if I have 2018-12-35 in my TextBox, the DateTime.Prase throws FormatException that is absolutely right.How can I determine which part of DateTime is wrong. For Example how to determine if Day or Month is wrong. DateTime.Parse tries a number of formats - some to do with the current culture, and some more invariant ones. It looks like it's including an attempt to parse with the ISO-8601 format of "yyyy-MM-dd" -...

 c#                     1 answers                     23 view
 2018-10-22         Giles

Java, recursively reverse an array

I haven't found anything with the specific needs of my function to do this, yes, it is for homework.So I have:public void reverseArray(int[] x) {}Precondition: x.length > 0The fact that I can't have the function return anything, and the only argument is an array is leaving me stumped.I've tried using loops along with the recursion, but everything I've tried seems to end up with infinite instances of the function being made.I've gotten an idea/suggestion to use another function along with this one, but, how to use the original recursively is beyond me at the moment.Any help ...

 java                     12 answers                     51 view
 2018-10-22         Giles

Can I delete these build folders when I am not running Android Studio?

I am backing up android studio projects in google drive and I found that the build folders contain thousands of files, so google drive ends up tired.My practice is that I run the 'clean project' command in Android Studio before exiting so that the unnecessary files are cleaned and only the important files remain to be backed up. But still sometimes the build folder remains there with many files.My question is that if I delete these two build folders manually (see screenshot), will my project rebuild again on next startup, or will it mess up my project? will my project ...

 android                     4 answers                     83 view
 2018-10-22         Giles

How to configure the layout so that the output will be output on the listview below the input search

I have created a design with the following source axml:when the listview output is shown getting data from the sqllite database the listview will overlap the test textview,edittext as below:Required Output Result Listview should be below as shown below:<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="#ffffff" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text="@string/test" ...

 xamarin.android                     2 answers                     16 view
 2018-10-22         Giles

gathering all info from database

I created a database for my wifes jewelry site. When i tried to gather the information from the database for the product page I only was able to get the last item I had put inside the database. I originally got the code from a tutorial and had to work on it in order to get any items at all. Basically I need to access all the product but I only get one. Can someone show me what I am missing?The code to bring up the items: $id = ''; if( isset( $_GET['id'])) { $id = $_GET['id']; } $sql = "SELECT * FROM products WHERE category = 'Accessories'";$result = mysqli_query($c...

 php                     2 answers                     3 view
 2018-10-22         Giles

TSQL Insert the column default value from Case Statement

I'd like to use the column's default value in an stored procedure insert, so that I don't have to repeat the default value in multiple places (it could change... DRY principle).The T-SQL INSERT operation has a handy 'default' keyword that I can use as follows:Declare @newA varchar(10)Set @newA = 'Foo2'-- I can use "default" like so...Insert into Table_1 ( A, B) Values ( @newA, default)However, If I need to do something conditional, I can't seem to get the case statement to return 'default'.-- How do I use 'default' in a case statement? INSERT INTO Table_1 ( ...

 sql                     1 answers                     68 view
 2018-10-22         Giles

Indexed view and T-sql that give same results as DISTINCT in SQL Server 2008 R2

I want to create indexed view MyView with such t-sqlSelect o.Theme_ID as Theme_ID, DATEADD(day, DATEDIFF(day, 0, o.Object_CreationDate), 0) as Objext_CreationDate, Count_BIG(*) as ObjectCount, o.Object_Tonality from [dbo].Object oinner join [dbo].Theme t on o.Theme_ID = t.Theme_IDinner join [dbo].[ThemeWorkplace] tw on t.Theme_ID = tw.Theme_IDinner join [dbo].Workplace w on w.Workplace_ID = tw.Workplace_ID ... where t.Theme_DeletedMark = 0 AND (w.Workplace_AccessType = 1 OR w.Workplace_AccessType = 8) AND Object_DeletedMark = 0 ... Group BY o.Theme_ID,o.Object_T...

 sql-server                     1 answers                     77 view
 2018-10-22         Giles

WCF client - when should the client close the channel

In a typical client-service application, where service is WCF, how to you use the service reference? For example, do you instantiate service for each call separately, or do you open one and keep it through the lifetime of the client app? (when I'm refering to 'instatiating service', I mean instantiate service object created by svcutil)For now we used one service instance on client, because that seemed faster than always creating, opening and closing the service for each and every call, but now I wander if that was OK? The main problem we have with this approach is that time...

 c#-4.0                     1 answers                     62 view
 2018-10-22         Giles

How to do a "select from" in more than two table using hibernate CriteriaQuery

I'm a beginner at Hibernate and I would like to do a select from in more than two tables using CriteriaQuery.I have 3 tables: Cellphone, CellphoneIamges and CellphoneRangedPrices andI would like to get the data from these three tables. One example: This query below get the data from tables:Select cellphone.cellphoneID, cellphone.cellphoneName, cellphoneImages.cellphoneImageID, cellphoneImages.cellphoneImageInternalLink, cellphoneImages.cellphoneImageExternalLink, cellphoneRangedPrices.cellphoneRangedPricesID, cellphoneRangedPrices.cellphoneRangedPriceStart, cellphoneR...

 java                     1 answers                     60 view
 2018-10-22         Giles

xampp not working, and error appears when I try to start my server

Error: Apache shutdown unexpectedly.11:58:07 [Apache] This may be due to a blocked port, missing dependencies, 11:58:07 [Apache] improper privileges, a crash, or a shutdown by another method.11:58:07 [Apache] Press the Logs button to view error logs and check11:58:07 [Apache] the Windows Event Viewer for more clues11:58:07 [Apache] If you need more help, copy and post this11:58:07 [Apache] entire log window on the forumsI can't start the server, the errors above appear when I try to https://www.youtube.com/watch?v=ULCz2hqVbQ0 watch this video but the language...

 php                     3 answers                     52 view
 2018-10-22         Giles

serviceworker location is wrong when integrating PWA to .NET Web Application using WebEssentials.AspNetCore.PWA

I am trying to integrate PWA to my .NET Web Application using WebEssentials.AspNetCore.PWA . I am following this tutorial https://medium.com/beginners-guide-to-mobile-web-development/introduction-to-pwa-in-asp-net-core-application-da96c7cc4918I have done everything that is mentioned in this tutorial. But I am getting following errorUncaught (in promise) TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.When I looked the doc of WebEssentials.AspNetCore.PWA : https://github.com/madskristensen/WebEssentials.AspN...

 c#                     1 answers                     87 view
 2018-10-22         Giles

SUMX with 2 Filters Q

I have the following code, which sums up all my fees for my clients.Code Snippert:SumAmtVar = SUMX ( FILTER ( _billings, _billings[_tsg_clientid_value] = accounts[accountid] ), __billings[Amount])What I need is an additional filter that filters my transaction dates for the current month or a hard coded date range. What would the second filter look like? Any help or assistance is greatly appreciated. You can put conditions together using the AND() function or more simply using &&.For example,SUMX( FILTER( Table1, <Condition 1> && <Condi...

 filter                     1 answers                     77 view
 2018-10-22         Giles

SED Command Replacement

Suppose I have a file with warnings. Each warning in a new line with an id that has 3 capital letters followed by 3 digits only, should be replaced by its id.Example:SIM_WARNING[ANA397]: Node q<159> for vector output signal does not existThe output should be ANA397 and the rest of line is deleted.How to do so using sed? I don't think you need sed for that. A simple grep with --only-matching could do, as in:grep -E 'SIM_WARNING\[(.)\]' --only-matching should work for you.Where: -E does "enhanced regular expressions. I think we need those for capturing with ( )then f...

 linux                     3 answers                     44 view
 2018-10-22         Giles

Pandas - expand dataframe using daterange

I have the following dataframe: name from amount days A 7/31/18 200 1 B 7/31/18 300 1 C 7/30/18 200 1 D 7/27/18 100 3 ...... G 7/17/18 50 1 H 7/13/18 150 4I'd like to expand it to this, where days does not equal 1: name from amount days A 7/31/18 200 1 B 7/31/18 300 1 C 7/30/18 200 1 D 7/29/18 100 3 D 7/28/18 100 3 D 7/27/18 100 3 ...... G 7/17/18 50 1 H 7/16/18 ...

 python                     2 answers                     82 view

Page 1 of 146  |  Show More Pages:  Top Prev Next Last