Google sheet countifs multiple criteria range with checkboxes - sorting
I am trying to display itemname+image once a checkbox is ticked in. If a checkbox is ticked twice, the item should be displayed two times - 3 times if all checkboxes for one item are ticked.
Current function doesn't work:
ifna(filter(BT!A5:B,BT!C5:C),if({1,1},char(999)));
ifna(filter(BT!A5:B,BT!D5:D),if({1,1},char(999)));
ifna(filter(BT!A5:B,BT!E5:E),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!I5:I),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!J5:J),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!K5:K),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!O5:O),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!P5:P),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!Q5:Q),if({1,1},char(999)));
ifna(filter(Hyjal!A5:B,Hyjal!C5:C),if({1,1},char(999)));
ifna(filter(Hyjal!A5:B,Hyjal!D5:D),if({1,1},char(999)));
ifna(filter(Hyjal!A5:B,Hyjal!E5:E),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!I5:I),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!J5:J),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!K5:K),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!O5:O),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!P5:P),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!U5:U),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!V5:V),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!W5:W),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!Q5:Q),if({1,1},char(999)))},
countifs(Hyjal!C:W,true,BT!C:W,true),,2,1)
If I split the function for each sheet and try it, it works.
ifna(filter(Hyjal!A5:B,Hyjal!C5:C),if({1,1},char(999)));
ifna(filter(Hyjal!A5:B,Hyjal!D5:D),if({1,1},char(999)));
ifna(filter(Hyjal!A5:B,Hyjal!E5:E),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!I5:I),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!J5:J),if({1,1},char(999)));
ifna(filter(Hyjal!G5:H,Hyjal!K5:K),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!O5:O),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!P5:P),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!U5:U),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!V5:V),if({1,1},char(999)));
ifna(filter(Hyjal!S5:T,Hyjal!W5:W),if({1,1},char(999)));
ifna(filter(Hyjal!M5:N,Hyjal!Q5:Q),if({1,1},char(999)))},
countif(Hyjal!C5:W37,true),,2,1)
And for the sheet BT I used
ifna(filter(BT!A5:B,BT!C5:C),if({1,1},char(999)));
ifna(filter(BT!A5:B,BT!D5:D),if({1,1},char(999)));
ifna(filter(BT!A5:B,BT!E5:E),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!I5:I),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!J5:J),if({1,1},char(999)));
ifna(filter(BT!G5:H,BT!K5:K),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!O5:O),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!P5:P),if({1,1},char(999)));
ifna(filter(BT!M5:N,BT!Q5:Q),if({1,1},char(999)))},
countif(BT!C5:Q73,true),,2,1)
So, I tried to combine those 2 functions with countifs, changed the column criteria range to C:W in the formula but it only displays items from the sheet Hyjal once items from the Sheet BT are checked. Items from BT itself are not displayed.
https://docs.google.com/spreadsheets/d/1hsCZMn1rif2eWpjShWBCH9kCLbSBEA66ZWjDwjhbyGE/edit?usp=sharing
The formula is in the BT+Hyjal Sheet in B3.
try:
=SORT(IFNA(FILTER(
{Hyjal!A:B; Hyjal!A:B; Hyjal!A:B;
Hyjal!G:H; Hyjal!G:H; Hyjal!G:H;
Hyjal!M:N; Hyjal!M:N; Hyjal!M:N;
Hyjal!S:T; Hyjal!S:T; Hyjal!S:T;
BT!A:B; BT!A:B; BT!A:B;
BT!G:H; BT!G:H; BT!G:H;
BT!M:N; BT!M:N; BT!M:N},
{Hyjal!C:C; Hyjal!D:D; Hyjal!E:E;
Hyjal!I:I; Hyjal!J:J; Hyjal!K:K;
Hyjal!O:O; Hyjal!P:P; Hyjal!Q:Q;
Hyjal!U:U; Hyjal!V:V; Hyjal!W:W;
BT!C:C; BT!D:D; BT!E:E;
BT!I:I; BT!J:J; BT!K:K;
BT!O:O; BT!P:P; BT!Q:Q}=TRUE)), 2, 1)
Related
Include an interactive plot (wordcloud) in a dashboard
I created an interactive dashboard using hvPlot .interactive and Panel: template = pn.template.FastListTemplate( title='Central Africa - Word Frequency Analysis', sidebar=['Frequency' , yaxis], main=[ihvplot.panel(), ipanel.panel()], accent_base_color="#88d8b0", header_background="#88d8b0", sidebar_width=450, theme='dark', ) template.show() Where ivplot and ipanel are my interactive plot and table, respectively. However, I would like to put instead of the table, an interactive wordcloud which I created using ipywidgets: list1 = ['Corbeau News','Journal de Bangui','Le Potentiel','Ndjoni Sango','RJDH','Radio Lengo Songo','Radio Ndeke Luka'] def makingclouds(Category,frame,col,atitle): wordcloud_bangui = WordCloud(stopwords= stopword , width=1600 , height=800 , background_color="black", colormap="Set2").generate(''.join(data_file_1['Content'])) plt.figure(figsize=(20,10),facecolor='k') plt.title(atitle, fontsize=40)#,fontweight="bold") plt.imshow(wordcloud_bangui, interpolation="bilinear") plt.axis("off") plt.tight_layout(pad=0) wordcloud = interact(makingclouds, Category=list1, df=fixed(data_file_1), col=fixed('Content'), atitle=fixed('Most used words media - Central Africa'), frame=fixed(data_file_1[['Source','Content']])) My question is how can I do it. I've tried simply to put 'wordcloud' instead of itable in the 4th line of the first piece of code but it tells me that the object does not have a function panel. What can I do?
sort_values() got multiple values for argument 'axis'
sort_values() got multiple values for argument 'axis' I am trying to sort this series using sort_values Item Per Capita GSDP (Rs.) Andhra_avg 102803 Arunachal_avg 100745 Assam_avg 55650.6 Bihar_avg 30030.6 Chattisgarh_avg 82046.7 Gujrat_avg 128755 Himachal_avg 126650 Jharkhand_avg 56385 Jammu_avg 73422.8 Karnataka_avg 128959 Kerala_avg 139140 MP_avg 61122.2 Maharashtra_avg 133512 my code: dfGDP_percapita.sort_values("Item", axis = 0, ascending = True, inplace = True, na_position ='first') Expected result should give "Per Capita GSDP (Rs.)" in the decreasing order with Nan on top
Try changing your code to dfGDP_percapita.sort_values("Item", inplace=True, na_position ='first') Some of the arguments are by default - I'm not sure why the error occurs, but my code works like this.
Pinescript duplicate alerts
I have created a very basic script in pinescript. study(title='Renko Strat w/ Alerts', shorttitle='S_EURUSD_5_[MakisMooz]', overlay=true) rc = close buy_entry = rc[0] > rc[2] sell_entry = rc[0] < rc[2] alertcondition(buy_entry, title='BUY') alertcondition(sell_entry, title='SELL') plot(buy_entry/10) The problem is that I get a lot of duplicate alerts. I want to edit this script so that I only get a 'Buy' alert when the previous alert was a 'Sell' alert and visa versa. It seems like such a simple problem, but I have a hard time finding good sources to learn pinescript. So, any help would be appreciated. :)
One way to solve duplicate alters within the candle is by using "Once Per Bar Close" alert. But for alternative alerts (Buy - Sell) you have to code it with different logic. I Suggest to use Version 3 (version shown above the study line) than version 1 and 2 and you can accomplish the result by using this logic: buy_entry = 0.0 sell_entry = 0.0 buy_entry := rc[0] > rc[2] and sell_entry[1] == 0? 2.0 : sell_entry[1] > 0 ? 0.0 : buy_entry[1] sell_entry := rc[0] < rc[2] and buy_entry[1] == 0 ? 2.0 : buy_entry[1] > 0 ? 0.0 : sell_entry[1] alertcondition(crossover(buy_entry ,1) , title='BUY' ) alertcondition(crossover(sell_entry ,1), title='SELL')
You'll have to do it this way if("Your buy condition here") strategy.entry("Buy Alert",true,1) if("Your sell condition here") strategy.entry("Sell Alert",false,1) This is a very basic form of it but it works. You were getting duplicate alerts because the conditions were fulfulling more often. But with strategy.entry(), this won't happen When the sell is triggered, as per paper trading, the quantity sold will be double (one to cut the long position and one to create a short position) PS :You will have to add code to create alerts and enter this not in study() but strategy()
The simplest solution to this problem is to use the built-in crossover and crossunder functions. They consider the entire series of in-this-case close values, only returning true the moment they cross rather than every single time a close is lower than the close two candles ago. //#version=5 indicator(title='Renko Strat w/ Alerts', shorttitle='S_EURUSD_5_[MakisMooz]', overlay=true) c = close bool buy_entry = false bool sell_entry = false if ta.crossover(c[1], c[3]) buy_entry := true alert('BUY') if ta.crossunder(c[1], c[3]) sell_entry := true alert('SELL') plotchar(buy_entry, title='BUY', char='B', location=location.belowbar, color=color.green, offset=-1) plotchar(sell_entry, title='SELL', char='S', location=location.abovebar, color=color.red, offset=-1) It's important to note why I have changed to the indices to 1 and 3 with an offset of -1 in the plotchar function. This will give the exact same signals as 0 and 2 with no offset. The difference is that you will only see the character print on the chart when the candle actually closes rather than watch it flicker on and off the chart as the close price of the incomplete candle moves.
Fields and Events in Elm 0.13
This question somehow relates to How to use Fields in Elm 0.13 (and we are working on the same assignment). In my case, everything that changes in the game should generate a Event: data Event = NewGame | PauseGame | Turn [KeyCode] | PlayerActive [Bool] | PlayerChanged [PlayerSettings] | Tick Time The PlayerChanged event, for example, is generated as follows: settingsSignal : Signal Event settingsSignal = lift PlayerChanged <| combine [ pOneSettingsSignal, pTwoSettingsSignal , pThreeSettingsSignal, pFourSettingsSignal] pOneSettingsSignal : Signal PlayerSettings pOneSettingsSignal = PlayerSettings <~ (Controls <~ lift toCode pOneUp.signal ~ lift toCode pOneDown.signal ~ lift toCode pOneLeft.signal ~ lift toCode pOneRight.signal) ~ (pOneColor.signal) ~ (lift contentToString pOneName.signal) where pOne<Direction> and pOneColor are inputs for dropDowns and pOneName is an Input for a Input.Field: pOneName : Input Content pOneName = input (Content nameOne (Selection 0 0 Forward)) I hereby assume that when I update the text field (or a dropdown), a PlayerChanged [PlayerSettings] event will be generated. All event get combined as follows: eventSignal : Signal Event eventSignal = merges [ clockSignal , newGameSignal , pauseGameSignal , turnSignal , activeSignal , settingsSignal ] and finally the event signal is lifted onto an update function: gameState : Signal Game gameState = foldp update initialGame eventSignal main = lift2 view gameState Window.dimensions However, when the game is paused, it seems that all input is blocked and no signals propagate anymore. Also, the text fields are uneditable. Each Input.Field for the player names is defined as follows: playerOneName : String -> Element playerOneName name = field defaultStyle pOneName.handle identity nameOne (Content name (Selection 0 0 Forward)) and then, in the view function pOneNameField = playerOneName playerOne.settings.name To me it seems like everything is correct. When editing the displayed field, pOneName.signal is changed, which causes (trough a series of liftings) a PlayerChanged event to be generated, which causes the model to be redrawn, which should show the new update. Somehow the Input.Field is still uneditable, however. Worse: even a simple NewGame event isn't generated anymore and events from the dropdowns are also not propagated: nothing changes. newGameSignal : Signal Event newGameSignal = always NewGame <~ (keepIf identity False <| space) If I start the game in playing mode (thus no input forms are shown), this works fine and I can reset the game. It seems like the inputs are blocking the event stream, but I can't figure out where its going wrong.
So, I fixed it. Appearantly the case (event, game.state) of (NewGame, _) -> ... (Tick t, Playing) -> statement is blocking, so it didn't match Tick Time signals sent in the Paused and Ended states and blocked there. A simple (_, _) -> game case fixed everything, so my 960 lines of Elm don't go to waste!
Sublime Text - Goto line and column
Currently, the Go to line shortcut (CTRL+G in windows/linux) only allows to navigate to a specific line. It would be nice to optionally allow the column number to be specified after comma, e.g. :30,11 to go to line 30, column 11 Is there any plugin or custom script to achieve this?
Update 3 This is now part of Sublime Text 3 starting in build number 3080: Goto Anything supports :line:col syntax in addition to :line For example, you can use :30:11 to go to line 30, column 11. Update 1 - outdated I just realized you've tagged this as sublime-text-3 and I'm using 2. It may work for you, but I haven't tested in 3. Update 2 - outdated Added some sanity checks and some modifications to GotoRowCol.py Created github repo sublimetext2-GotoRowCol Forked and submitted a pull request to commit addition to package_control_channel Edit 3: all requirements of the package_control repo have been met. this package is now available in the package repository in the application ( install -> GotoRowCol to install ). I too would like this feature. There's probably a better way to distribute this but I haven't really invested a lot of time into it. I read through some plugin dev tutorial really quick, and used some other plugin code to patch this thing together. Select the menu option Tools -> New Plugin A new example template will open up. Paste this into the template: import sublime, sublime_plugin class PromptGotoRowColCommand(sublime_plugin.WindowCommand): def run(self, automatic = True): self.window.show_input_panel( 'Enter a row and a column', '1 1', self.gotoRowCol, None, None ) pass def gotoRowCol(self, text): try: (row, col) = map(str, text.split(" ")) if self.window.active_view(): self.window.active_view().run_command( "goto_row_col", {"row": row, "col": col} ) except ValueError: pass class GotoRowColCommand(sublime_plugin.TextCommand): def run(self, edit, row, col): print("INFO: Input: " + str({"row": row, "col": col})) # rows and columns are zero based, so subtract 1 # convert text to int (row, col) = (int(row) - 1, int(col) - 1) if row > -1 and col > -1: # col may be greater than the row length col = min(col, len(self.view.substr(self.view.full_line(self.view.text_point(row, 0))))-1) print("INFO: Calculated: " + str({"row": row, "col": col})) # r1.01 (->) self.view.sel().clear() self.view.sel().add(sublime.Region(self.view.text_point(row, col))) self.view.show(self.view.text_point(row, col)) else: print("ERROR: row or col are less than zero") # r1.01 (->) Save the file. When the "Save As" dialog opens, it should be in the the Sublime Text 2\Packages\User\ directory. Navigate up one level to and create the folder Sublime Text 2\Packages\GotoRowCol\ and save the file with the name GotoRowCol.py. Create a new file in the same directory Sublime Text 2\Packages\GotoRowCol\GotoRowCol.sublime-commands and open GotoRowCol.sublime-commands in sublime text. Paste this into the file: [ { "caption": "GotoRowCol", "command": "prompt_goto_row_col" } ] Save the file. This should register the GotoRowCol plugin in the sublime text system. To use it, hit ctrl + shift + p then type GotoRowCol and hit ENTER. A prompt will show up at the bottom of the sublime text window with two number prepopulated, the first one is the row you want to go to, the second one is the column. Enter the values you desire, then hit ENTER. I know this is a complex operation, but it's what I have right now and is working for me.