Pandas assign field if condition - python-3.x

just a little help please.
I have this csv structure.
login. user
user1
user1
user\002. this strings comes from the merge
I will explain this data frame
I have different fields merged inside user, but in specific cases, I want to check if the column login is not empty, to replace all the content of user for that specific row, with the content of login but stripping out all the characters of the string.
so this is what I would like to have as an output
login. user
user1
user1
user\002. 002
am new to pandas, and I would like to know how can I check if a field is populated, to copy its data to another one, stripping down some strings from it?
thank you very much for any help you can provide me with.
EDIT:
I do apology if my post wasn't clear enough. Ill try to explain my self better.
my actual csv file look something like this.
login. field1 field2 user
123456 123456
1894673 1894673
1263546 1263546
253647 253647
username\002. username. username
The column user, is a merge between 2 other fields, so what I am doing, I am checking those 2 fields, looking for the userID and I am passing that ID to the user column.
Like in my previous example, my code checks for field1 and field2, and does the merge into user field, in this way I am getting the ID of that user.
But in some row, field1 or field2 contain the actual username of the user, in this case username, but if we look at login it contain the username AND the userID. This particular case, happens only when the login is not empty.
So what I would like to do, is check if the login is not empty, to copy its content to user and strip everything before the \ so my result will be as follow
login. field1 field2 user
123456 123456
1894673 1894673
1263546 1263546
253647 253647
username\002. username. 002
Thank you again

Related

Flow to copy USER to another column

Can I copy a user from one column to another? Not the separated value, but the actual user. Right now, I can't copy USERs, only their strings.
I've built a conditional flow that currently copies the USER:EMAIL from either Column A (USER) or Column B (USER) to Column C (TEXT). But instead of just the EMAIL value, I want to copy the user, whole. That would allow me to AUTOMATE from the SP LIST instead of using Flow.
Found it. Must use the USER:EMAIL in the USER CLAIMS field in the Update Item section. Don't really understand why, other than the lookup is achieved via the email. Wish this were more obvious.

SharePoint 365 - Get user name based on user id returned from api to separate list

I'm getting a user id number back when I API a person field on a list. I'm hoping someone knows of an easy way to get the user name value for a particular user id.
My goal is to populate a person field in my current list form with a value from a person field in another list based on certain conditions, but unfortunately I'm not sure how to utilize the user id toward this end.
I think I figured it out. Instead of using a people picker I used an ASP textbox and databind to update to the user id. Appears to work.

Storing email id in Cassandra using list or set

I am trying to store 800 email id's using list or set collection in Cassandra. Can anyone give suggestion if it is advisable or not.
Our requirement is: we are trying to save the email id's and may require to fetch all 800 email id at once or any 1 email id from the list of 800 email id's depending on the select query. We also need to search a specific email id from the list. Can anyone give some suggestion.
Our requirement is: we are trying to save the email id's and may require to fetch all 800 email id at once or any 1 email id from the list of 800 email id's depending on the select query. We also need to search a specific email id from the list. Can you please give some suggestion
If you need to query for specific email address it is better keep them is regular text or varchar column. But if you always use all 800 number at the same time. then either way is fine.
can you explain your use case more so we can help you better

SOQL Salesforce database query, search for two joined fields with one string

So far I'm generating a query like so:
$query = "SELECT $imploded From Contact WHERE FirstName LIKE '%$var%' OR LastName LIKE '%$var%' OR Email LIKE '$var'";
Where imploded contains a list of fields and var is the input from the search. Because of the way it's set up in the salesforce database, First name and last name are two different fields. So let's say the search is Shelby, you would get a response if Shelby is indeed in the database, however if you try Shelby X, it can't look into both fields and confirm this. Is there a way to make it search both First and Last names?
The Name field is a read-only standard field that acts as a combination of FirstName and LastName. You should be able to use it in your query in a similar way:
$query = "SELECT $imploded From Contact WHERE
FirstName LIKE '%$var%' OR LastName LIKE '%$var%'
OR Name LIKE '%$var%' OR Email LIKE '%$var%'";
You may also want to look into SOSL, which allows you to search multiple fields across objects (or specify those that you are interested in).

form not picking up data from another database

I have a form. When I open the form the two fields called office and group should be picked up from another database named something like staff.nsf. The data is picked up based on the applicant name as key. I have included my name in staff database. But the form is not picking up the two fields from the staff database.
The field formula goes like this,
server := #Name([CN]; #Subset(#DbName; 1));
temp:= #If(Applicant != ""; #DbLookup( "" : "NoCache"; server:"Mast\\Staff.nsf";
"ByApplicant";Applicant; 2); "");
#If(#IsError(temp);"";temp)
Is it a system bug? Can anybody help please.
Regards,
Priya
Lotus Notes is more than 20 years old, and extremely well-tested. It is very unlikely that you have found a "system bug". There are any number of possible problems here, and you need to carefully rule them out until you find the actual problem.
The first thing you should do is take the #IsError out of the formula (temporarily). By having it there, you are suppressing a potentially useful error message. Ok... admittedly the error messages are usually not that helpful, but sometimes they are. If you don't want to take it out of your formula, just add another computed-for-display field with just the #DbLoookup -- and follow Ken's advice about hard-coding everything.
Then review all of the following:
Is "mast\staff.nsf" the correct path for the database?
Do you have access to the database?
Is "ByApplicant" the correct name for the view? (Spelling errors happen!)
Do you have access to the view?
Do you have access to the documents in the view?
As Ken mentioned, is the first column in the ByApplicant view sorted?
Is the name value you are passing for Applicant in the exact same format that appears in the view column? (I.e, if it appears in abbreviated form in the view column, make sure that you are passing it to #DbLookup in abbreviated format.)
Does the second column of the view contain the value that you are trying to read? (Check out the rules for counting columns in the documentation for #DbLookup.)
A few thoughts:
The ByApplicant view needs to have its first column sorted alphabetically and that column should be the list of applicant names you are matching on
Try hard coding the value for applicant in the #DBLookup to see if it works, and to rule it out as the problem.
This does not work on the web, only on the client (I believe)

Resources