Skip to content

Instantly share code, notes, and snippets.

// https://community.qlik.com/t5/QlikView-App-Development/number-of-17-digits/m-p/511285
/*
Henric_Cronström
Employee
Henric_Cronström
Employee 2013-09-12 01:44 PM
Re: number of 17 digits
As Gysbert says, such a large number cannot be displayed as an integer. The 64-bit IEEE float can only show 14 digits. Instead, you should try
*/
fake_data_index = pd.MultiIndex.from_product([
[
'nate',
'jess'
], pd.date_range('2019-01-01', '2019-12-31')
], names=('who', 'date'))
fake_df = pd.DataFrame({
'increasing': np.arange(len(fake_data)),
'random': np.random.rand(len(fake_data))
}, index=fake_data_index)
#Create a new field 'datetime', which converts strings to a datetime object
# datetime object will make our x-axis look good, showing appropriate labels like "Feb 2018" etc...
pyber_data_df['datetime'] = pd.to_datetime(pyber_data_df['date'])
# a datetime object *also* allows us to access the date part (2019-01-04) , ignoring the time-of-date part (05:39:20)
#Create another new field 'datedate' to store it
pyber_data_df['datedate'] = pyber_data_df['datetime'].dt.floor('d')
avg_fare_by_type_date = (pyber_data_df
#group by multiple fields by passing a list of those fields ;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theredpea
theredpea / 20191023__live_session__ufo_filter_neo_challenge.ipynb
Last active October 27, 2019 17:08
helping neo with some test data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theredpea
theredpea / DU_fall_analytics_baseball_player_most_frequent_position.sql
Last active October 27, 2019 16:52
finding a player's most frequent position
Nate, I am working on finding the primary position as we talked about. I have queried the db and summed each of the positions for a given player, but have hit a roadblock with finding the max and making that the primary position. I thought of using a CASE statement, but I would have to have a variable for the current max that updates as it looks at each position. I can do that in python, but I am not sure how to do that in sql. Thanks. I will paste my code below.
SELECT
playerID,
sum(G_all) Total_Games,
sum(GS) as Games_Started,
sum(G_p) as Games_Pitched,
sum(G_c) as Games_Catcher,
sum(G_1b) as Games_First_Base,
sum(G_2b) as Games_Second_Base,
sum(G_3b) as Games_Third_Base,
(******************************************************************************)
(* QlikView Expression Syntax *)
(******************************************************************************)
(* An extended subset of the script syntax file *)
(* *)
(* Things like function, field, macro and bookmark names are added at runtime *)
(* *)
(******************************************************************************)
SET l1 = SUM(1);
SET l2 = COUNT($(l1));
SET l3 = AVG($(l2));
TRACE $(l3); // traces "AVG(COUNT(SUM(1))", ok...
LET ll1 = 'SUM(1)';

Load this data:

LOAD DUAL(t,n) INLINE [ t,n A,1 B,2 C,3];

Select "A", create a bookmark