Building a dashboard using streamlit - widget

I am trying to create a user widget for the epl table that accepts both the home team and away team selection. how to I do it?
I had used
# sidebar team selection
sorted_unique_team = sorted(df.Home.unique())
selected_team = st.sidebar.selectbox("Home", sorted_unique_team)
that works so nicely. But it displays only the home results. how do I create one that can also output either the home team results or the away results of a team bearing in mind that there is a separate column for the away results within the same dataframe.

Related

Show no results if search box is empty using Filter Function on Google Sheets

I'm hoping somebody has a quick solution for me. I have a fantasy sport league setup on a google sheet. One of the sheets allows other people to search a database of players. Its broken down into four different search boxs offering the following search options: By Player, Position, Owner or Player designation. I'm using the filter function:
=filter(Sheet242!A2:E,search(B6,Sheet242!A2:A),search(E6,Sheet242!E2:E),search(B8,Sheet242!C2:C),search(E8,Sheet242!B2:B))
It draws from a table on a separate sheet.
This works great with one exception. It returns all the values in my table when all 4 search boxes have no value. I want it to filter no results if all 4 boxes are empty.
Here is a link to my google sheet so you can have a better visual of what im trying to do:
https://docs.google.com/spreadsheets/d/1XlfWyDOi-cEynVCcnWEpbOF7qIm_HlAKk2yG31rYvJw/edit?usp=sharing
The two sheets in question are "Player Database" and "Sheet 242".
Any suggestions would be greatly appreciated!
try:
=IF(LEN(B6&B8&E6&E8)=0,, FILTER(Sheet242!A2:E,
SEARCH(B6, Sheet242!A2:A), SEARCH(E6, Sheet242!E2:E),
SEARCH(B8, Sheet242!C2:C), SEARCH(E8, Sheet242!B2:B)))

selecting multiple items in an AS3 list component based on values

I've created a flash AS3 user form for sales people. When I create a user, I select multiple cities from a list component and drop them into an array. When added to the mySQL DB these entries are kept in a separte table which I can then call upon at any time using XML to bring them back into AS3. Now I'm using the same form as a user updaete form and populating it with data from previous MySQL insert.
My question is - How could I have these cities show as 'selected' on the list Component when the update form is loaded? Thus allowing the someone to add to or substract from that selection set. I'm trying to set selectedItems to match the ID's in the XML but failing miserably.
as a test I tried
addUser.citiesList.selectedItems = [3,4];
addUser.citiesList.selectedIndices = [3,4];
The selectedItems yield nothing but the selectedIndices works but I don't want to start matching indexes with Item ID's
looked all over but can't seem to find an answer. Am I missing something or is this not possible?
Well I finally got it working.
Having got the data out of the MySQL db, through PHP and into Flash as XML, I then pushed the user city values into a userCity array.
I got the AS3 list component in the form populated in the same way with all the cities.
I then used the userCity array in a nested for loop to inerate through all the cities in the list component, picking out the ones that had been previously selected and grabbing the index of each to pop into a new array which was the array used for the 'selectedindicies' and hey presto. I now have a cities list (about 36 cities) with the previously selected cities (about 5 cities) already selected and highlighted so that the user knows which cities the sales peson already manages. Now they can add or subtract from that and it will be picked up by my on change event as normal.
The Adobe resources on selectedIndices and selectedItems, for someone like me, who's learning is to say the least - pittyful...
I hope this helps someone else out...

Steam web API getting CS:GO inventory

Alright, so I have been looking for this all over the internet, and what I have found out is that when you want to get someones steam inventory you use this:
http://api.steampowered.com/IEconItems_{appid}/GetPlayerItems/v0001/?key={apikey}&steamid={steamid}&format=json
But the problem is that when I do that for CS:GO (appid: 730), I just get an empty response back, even though the user has items in their inventory.
if you want to get the json just use one of the following links:
general steam inventory: ( 1: games, 3: coupons, 6: trading cards, 7: rewards )
http://steamcommunity.com/id/<USERURL>/inventory/json/753/1
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/1
http://steamcommunity.com/id/<USERURL>/inventory/json/753/3
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/3
http://steamcommunity.com/id/<USERURL>/inventory/json/753/6
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/6
http://steamcommunity.com/id/<USERURL>/inventory/json/753/7
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/7
games :
http://steamcommunity.com/id/<USERURL>/inventory/json/<APPID>/2
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/<APPID>/2
the problem was not the counter-strike appid,
you just used an old link that only works for the general steam inventory.
I suggest you using the link using STEAMID because not every steamuser has set a customurl.

Best way to use a custom table in a relationship (in ExpressionEngine)?

So, I’m a bit on how to use a separate table in a relationship, or something like that…
I have a table with around 5000 hotels called exp_h_hotels.
On my website, I use the pages module to create a static subpage for each part of the country. I want to list all hotels that belong to a specific region.
I have understood that I can’t do something like this (using ExpressionEngine tags with the query module):
{exp:query sql="SELECT * FROM exp_h_hotels WHERE h_regionname ='{regionname}'"}
{hotel_name}
{/exp:query}
Anyone knows the best way to go forward with this?
I have looked into using the ExpressionEngine API to insert the data into a channel – however, I get the feeling that it wouldn’t be optimal to flood the channel entries table with 5000 posts with 14-20 fields with data each.
There's no reason why this shouldn't work as you expect, so long as your exp:query tag is inside your channel:entries tag:
{exp:channel:entries channel="pages" limit="1"}
<h1>Hotels in {regionname}</h1>
<ul>
{exp:query sql="SELECT * FROM exp_h_hotels WHERE h_regionname ='{regionname}'"}
<li>{hotel_name}</li>
{/exp:query}
</ul>
{/exp:channel:entries}
However, for the long-term, importing your hotels into a new channel in EE is a much better plan. You could export from your database to CSV (using phpMyAdmin perhaps) and then import into EE using DataGrab. Nothing wrong with adding 5000 new entries to EE.

PHP/MySQL - Changing Query on clicking a link

I have a very basic site (just learning this stuff) where I have the results for a hockey pool I do from here.
I want to build a page that lists the players and then when they click on a name, a page comes up with just that player's picks on it. You can see the kind of page I mean here.
THis page currently only shows one player, as I am using this query:
$q = "SELECT *, player_id, handle
FROM round_one
INNER JOIN players USING (player_id)
WHERE (player_id = 1)";
Right now I have it set just to return player_id 1, but I want it to do player_id 2, 3, 4 etc depending on what linked name they click on.
I have been reviewing some documentation on sort by columns queries when clicking on a column header, and am thinking this is sort of the approach I should be taking, but I just can't seem to figure out the correct way to do it.
You can achieve this by passing a parameter to the view_picks_by_player.php page, and then PHP can pick up that parameter and generate content for the appropriate player.
For example, in the page where you select the player you want stats for you could have:
<a href='view_picks_by_player?id=player1'>Get Player 1's Stats!</a>
<a href='view_picks_by_player?id=player2'>Get Player 2's Stats!</a>
And then in the top of the view_picks_by_player.php page you could have:
$id = $_GET['id'];
$sql = "SELECT * FROM player_stats WHERE id = '$id'";
Obviously your SQL is structured differently, but this is just a quick way to show how you can pass a variable to the php page so it can generate different content dynamically.
For security, you'll want to validate that the user has not typed anything nasty into the URL as the 'id' before you use it in your SQL, but that's another topic...