Categories
Mastering Development

how to make a table with unique count and count + percentage information

I am a r beginner. Please pardon me if this question sounds silly. If I have a data set like this: x<-data.frame( “ID”=c(21,17,21,19,22,21,26,22,18, 15), “sick”=c(T,T, F, T,T,F, T,T, T, F), “recover”=c(T,T,T,F,F,T,T,T,F,F)) and I want to make a table out of it, something looks like: Note unique count ID is 7, event count is 10. what […]

Categories
Mastering Development

Minimization problem with linking constraints in R

How should I incorporate the linking constraints into the optimization problem formulation in equations 1 – 4 where Y_i’s are binary variables? minimize 22X11 + 20.5X12 + 21X13 + 19X14 + 21X21 + 21X22 + 18X23 + 17X24 + 22X31 + 24X32 + 22X33 + 23X34 + 22X41 + 16X42 + 17X43 + 17.5X44 + […]

Categories
Mastering Development

3D bar plot with dates, strings and numbers in 3 axes with matplotlib in python

I have three lists as mentioned below. xx = [‘TT’, ‘AN’, ‘AP’, ‘AR’, ‘AS’, ‘BR’, ‘CH’, ‘CT’, ‘DN’, ‘DD’, ‘DL’, ‘GA’, ‘GJ’, ‘HR’, ‘HP’, ‘JK’, ‘JH’, ‘KA’, ‘KL’, ‘LA’, ‘LD’, ‘MP’, ‘MH’, ‘MN’, ‘ML’, ‘MZ’, ‘NL’, ‘OR’, ‘PY’, ‘PB’, ‘RJ’, ‘SK’, ‘TN’, ‘TG’, ‘TR’, ‘UP’, ‘UT’, ‘WB’] yy = [datetime.date(2020, 5, 27), datetime.date(2020, 5, 28), […]

Categories
Linux Mastering Development

script help to extract value

I have the following text file that I want to manipulate add_journal_volume group=”RPCG_VLS_PSALTUXP201″ copy=”TW_PROD_VLS” uid=”60,06,01,60,01,d0,40,00,37,1e,85,5e,17,9c,ea,11″ uid_hash=”0xfd81565b74f160c3″ -f; add_replication_volume group=”RPCG_VLS_PSALTUXP201″ copy=”VNX057_CRR_PSALTUXP201″ replication_set=”RSet0″ uid=”60,06,01,60,0e,60,3c,00,16,f5,56,7f,02,d8,e8,11″ uid_hash=”0xd7c77496f2520fbc” -f; add_replication_volume group=”RPCG_VLS_PSALTUXP201″ copy=”VNX057_CRR_PSALTUXP201″ replication_set=”RSet1″ uid=”60,06,01,60,0e,60,3c,00,18,f5,56,7f,02,d8,e8,11″ uid_hash=”0x62d865f2be9ff409″ -f; Basically I just want to return as column delimited text using “;” RPCG_VLS_PSALTUXP201;TW_PROD_VLS;;60,06,01,60,01,d0,40,00,37,1e,85,5e,17,9c,ea,11 RPCG_VLS_PSALTUXP201;VNX057_CRR_PSALTUXP201;RSet0;60,06,01,60,0e,60,3c,00,16,f5,56,7f,02,d8,e8,11 RPCG_VLS_PSALTUXP201;VNX057_CRR_PSALTUXP201;RSet1;60,06,01,60,0e,60,3c,00,18,f5,56,7f,02,d8,e8,11 The tricky part is those add_journal_volume line there is […]

Categories
Mastering Development

Difficulty aligning xticks to edge of Histogram bin

I am trying to show the frequency of my data throughout the hours of the day, using a histogram, in 3 hour intervals. I therefore use 8 bins. plt.style.use(‘seaborn-colorblind’) plt.figure(figsize=(10,5)) plt.hist(comments19[‘comment_hour’], bins = 8, alpha = 1, align=’mid’, edgecolor = ‘white’, label = ‘2019’, density=True) plt.title(‘2019 comments, 8 bins’) plt.xticks([0,3,6,9,12,15,18,21,24]) plt.xlabel(‘Hours of Day’) plt.ylabel(‘Relative Frequency’) […]

Categories
Mastering Development

Distance calculation optimization in R

I would like to know if there is any way to optimize the distance calculation process below. I left a small example below, however I am working with a spreadsheet with more than 6000 rows, and it takes considerable time to calculate the variable d. It would be possible to somehow adjust this to have […]

Categories
Mastering Development

How to concatenate two different into one array [duplicate]

I have two arrays of arrays: [array[(1, 2, 3)], array[(4, 5, 6, 7)], array[(8, 9, 9.5)]] [array[(10, 11, 12)], array[(13, 14, 15)], array[(16, 17, 18, 19)]] What I need to have is: [[array([1, 2, 3]), array([10, 11, 12])], [array([4, 5, 6, 7]), array([13, 14, 15])], [array([7, 8, 9.5]), array([16, 17, 18, 19])]] I can do […]

Categories
Mastering Development

limited size dates groups by interval

I have a data frame with dates and I would like to group dates by interval of 9 days, but the group size should be of 7 dates maximum. So if we find 9 days in the interval, the 2 last dates should roll to the next group and so on. And the starting date […]

Categories
Ask Engineering

ESP-32 won’t communicate at all

I’m trying to program an ESP32-WROOM-32 on my own PCB. I’m an amateur. I asked a related question about how to program an ESP32 using an Arduino a few days ago. I’ve been experimenting with it and no matter what I try I always get “Timed out waiting for packet header”. I hook everything up […]

Categories
Mastering Development

How to calculate the time spent at location for each unique ID per day?

I’m currently working on the smartGPA dataset (https://studentlife.cs.dartmouth.edu/smartgpa.pdf) and I was trying to calculate the time spend studying at a location at each day for each student (UID) to eventually get a mean study time for each student. I have timestamp data and location data for each student based on wifi location data. For example, […]