Instead of:
=ZÄHLENWENN([B16.xlsx]ListeVU!$Y:$Y;F5)
I would like to have like:
=ZÄHLENWENN(["C6".xlsx]ListeVU!$Y:$Y;F5)
But this does not work.
As per my comment you'd need to use INDIRECT(). The right syntax would be:
=COUNTIF(INDIRECT("'["&C6&".xlsx]ListeVU'!$Y:$Y"),F5)
Or in german:
=ZÄHLENWENN(INDIREKT("'["&C6&".xlsx]ListeVU'!$Y:$Y");F5)
Related
How could I just match the first anchor tag and not all of them until the last one? Basically all of this: "<a...>...</a>" without the other ones? Would I need to sub the string before matching?
Here's what I got:
https://regex101.com/r/hXh2JI/1
Thank you!
Try
<a[^>]*>[^<]*</a>
I think this regex does what you're asking for. Add the global and multi line regex flags to capture all cases of <a> ... </a>.
Regex looks like this:
(<a>.*<\/a>)
There is one condition where I have to split my string in the manner that all the alphabetic characters should stay as one unit and everything else should be separated like the example shown below.
Example:
Some_var='12/1/20 Balance Brought Forward 150,585.80'
output_var=['12/1/20','Balance Brought Forward','150,585.80']
Yes, you could use some regex to get over this.
Some_var = '12/1/20 Balance Brought Forward 150,585.80'
match = re.split(r"([0-9\s\\\/\.,-]+|[a-zA-Z\s\\\/\.,-]+)", Some_var)
print(match)
You will get some extra spaces but you can trim that and you are good to go.
split isn't gonna cut it. You might wanna look into Regular Expressions (abbreviated regex) to accomplish this.
Here's a link to the Python docs: re module
As for a pattern, you could try using something like this:
([0-9\s\\\/\.,-]+|[a-zA-Z\s\\\/\.,-]+)
then trim each part of the output.
I want to use printing command bellow in many places of my script. But I need to keep replacing "Survived" with some other string.
print(df.Survived.value_counts())
Can I automate the process by formating variable the same way as string? So if I want to replace "Survived" with "different" can I use something like:
var = 'different'
text = 'df.{}.value_counts()'.format(var)
print(text)
unfortunately this prints out "df.different.value_counts()" as as a string, while I need to print the value of df.different.value_counts()
I'm pretty sure alot of IDEs, have this option that is called refactoring, and it allows you to change a similar line of code/string on every line of code to what you need it to be.
I'm aware of VSCode's way of refactoring, is by selecting a part of the code and right click to select the option called change all occurances. This will replace the exact code on every line if it exists.
But if you want to do what you proposed, then eval('df.{}.value_counts()'.format(var)) is an option, but this is very unsecured and dangerous, so a more safer approach would be importing the ast module and using it's literal_eval function which is safer. ast.literal_eval('df.{}.value_counts()'.format(var)).
if ast.literal_eval() doesn't work then try this final solution that works.
def cat():
return 1
text = locals()['df.{}.value_counts'.format(var)]()
Found the way: print(df[var].value_counts())
For example function(null,null,10), How to change to function(null,10,10)?
I used
%s/(function(null,)null/\110
to achieve the same, I want to know more abstract method that can replace the second to any number
You can do it like this:
:%s/\(\zsnull.\{-}\)\{2}/REPLACE/
https://stackoverflow.com/a/45901621/2541070
This line will change the 2nd parameter into 10, without checking if the first parameter is null or something else. (You didn't ask for that in your question):
s/function(\S*,\zs[^,]*\ze,/10/
I'm having trouble trying to use replace characters in MS excel. Help says * and ? can both replace characters, but if I try using them in IF, I don't get correct results.
For example:
A1="something"
=IF(A1="*mething";"yes";"no")
I always get no... How to use * correctly?
wildcards don't work with comparison operators like =
To achieve what you want you can use COUNTIF which does accept wildcards, i.e.
=IF(COUNTIF(A1;"*mething")>0;"yes";"no")
or RIGHT function like
=IF(RIGHT(A1;7)="mething";"yes";"no")
Wildcards cannot be used in this context. Use something like:
=IF(ISERROR(FIND("mething",A1)),"No","Yes")