Retriving the 'match' patterns from the column of a dataframe and append in list - regex

I want to retrieve the values of order numbers and store it in a list. But the problem is I am able to fetch one not the other
ID Order
test#xyz.com 1-1155945200890<<<<able to fetch this
test1#xyz.com Hi how are you? 1-1155945200890<<<not able to fetch
By using below I am able to retrive the values to those column which do not have the junk data with it like that of just '1-1155945200890' but not from 'Hi how are you? 1-1155945200890'
To define feedback:
for user in users:
intent_name=data_to_analyse2.loc[data_to_analyse2['ID'] == user]
intent_list=list(intent_name['INTENTNAME'])
feedback=list(intent_name['Input'])
to fetch the match pattern:
pattern=re.compile("1[\-][\d]{2,15}")
pattern_list=list(filter(pattern.match, feedback))
How can I get all the values to the matching expression even if it has junk data associated with it

Related

How to transform to Entity Attribute Value (EAV) using Spoon Normalise

I am trying to use Spoon (Pentaho Data Integration) to change data that is in typical row format to Entity Attribute Value format.
My source data is as follows:
My Normaliser is setup as follows:
And here are the results:
Why is the value for the CONDITION_START_DATE and CONDITION_STOP_DATE in the string_value column instead of the date_value column?
According to this documentation
Fieldname: Name of the fields to normalize
Type: Give a string to classify the field.
New field: You can give one or more fields where the new value should transferred to.
Please check Normalizing multiple rows in a single step section in http://wiki.pentaho.com/display/EAI/Row+Normaliser. Accordind to this, you should have a group of fields with the same Type (pr_sl -> Product1, pr1_nr -> Product1), only in this case you can get multiple fields in output (pr_sl -> Product Sales, pr1_nr -> Product Number).
In your case you can convert dates to strings and then use row normalizer with single new field and then use formula for example:
And then convert date_value to date.

Fusion tables query does not fetch some

I'm having an issue on this table: 1g_ydg74ooUSBzNfQBHOIdgrOKhxZD_92In8xTDg
I'm trying to fetch some results by CODE_DEPT. I used the filter
CODE_DEPT IN ('001', '002', '003', '02A', '02B')
and only the 3 first are fetched.
Any idea what's going on ?
Cheers
Looks like CODE_DEPT is identified as a numeric column. The last two codes are not numeric and so would not match anything. If you change the column to type Text and you should be OK.

Django Filter Returns 0 Results Even Though Database Table Has Data

I have been stumped with this one for hours. A query filter in Django is not behaving as expected, and I'm wondering if it's related to either (a) reserved word or (b) unicode confusion or (c) something totally different.
I have a model called Route with the following fields:
from_number = models.CharField(max_length=15)
other_number = models.CharField(max_length=15)
I want to get a list of other_number's from the database where the from_number equals a variable from_number.
This is the code I'm trying, but it returns an empty list:
list = Route.objects.filter(from_number=from_number).values_list('other_number', flat=True)
Even if I hard-code the value in the filter to a value that I know is in the database like this, I get an empty list:
list = Route.objects.filter(from_number='+18005551212').values_list('other_number', flat=True)
However, from inspecting the database (PostgreSQL), I know the database has several rows that should be returned. For example, this code without the filter returns a list of all the values:
list = Route.objects.all().values_list('other_number', flat=True)
Any suggestions?
Thanks.

Removing Duplicate Lines from JQuery Autocomplete TextBox

My datasource returns up to 3 different values for each item: name, a company name, and an email address
The problem is, this ends up returning the same company names multiple times in the returned list of suggestions.
I want to remove these duplicate values from the list using jquery code.
Most probably you are doing with some JOIN functions and there by
joining multiple tables.To avoid duplicate in the results,you need to
do that on the server side i mean the part which fetches company name
email and address add a GROUP BY to your SQL Query
$sql = "SELECT * FROM some_table GROUP BY your_table_primary_key"

FileMaker - How to have distinct values listed on-screen?

I would like to have the distinct values of a repeating field listed in another field (in browse mode). The case is as follows:
I have a field that contains country names. The country names in this field may repeat themselves, thus when using the "List" function I get something like "France, France, France, Germany, Germany, Hungary".
How can I create a field that lists all the values from my country field, but has it grouped as "France, Germany, Hungary"?
In the case I could directly use a SQL query to interfere with the FileMaker databse I would use the GROUP BY statement.
To make a summary of all the values across every record, do as follows:
Make a new value list labeled 'Countries' (File Menu > Manage > Value Lists)
Make the value list 'Use Values From Field' and specify your repeating field
Create a new Calculation field, 'Listed Countries'
Set the calculation to type 'Text' and with the following code:
ValueListItems ( Get(FileName) ; "Countries" )
If you'd like to find the value for only the current record:
Make a new Table Occurrence, 'NewTO' of the same base table and link the two records by a unique index.
Change the 'Countries' value list so that it obtains values from 'NewTO' and your repeating field.
Select 'Only include related values starting from' and select your original Table Occurrence
If you'd like the list to update as the repeating field value changes, make certain that you Do Not Store Calculation Results for the field.

Resources