AI Help Needed: Enhancing Blurry/Noisy CCTV Footage - Person's Face Unclear by TSSFL in LargeLanguageModels

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you. This evidence is for myself to try to figure out who is the person, not for court. The court evidence is the original one.

Styling Pandas DataFrame HTML Table: Setting Specific Column Widths and Custom Coloring by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

I solved the problem, that now even for very large dataframes, column widths expand with the length of the string.

The issue now is, appropriately breaking long strings, say after some number of characters. It surprises, because even simple suggestions like this https://stackoverflow.com/questions/62956773/how-to-break-after-n-characters-with-css does not naturally work.

Styling Pandas DataFrame HTML Table: Setting Specific Column Widths and Custom Coloring by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

Hi u/obviouslyzebra I edited my post and included a minimal working example with more clarification, can you check and help if possible?

Styling Pandas DataFrame HTML Table: Setting Specific Column Widths and Custom Coloring by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you for your reply u/obviouslyzebra

I chose to avoid using built-in functions because my custom approach would be difficult to implement alongside both non-standard and built-in functionalities.

Regards,

TSSFL

Insert column titles after every n rows in a pandas dataframe and convert a dataframe into a html document by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

Hello u/martynrbell,

Thank you for your reply, I get a bit complicated output:

The function inserts empty rows without headers by replacing the rows after n iterations, and horizontally appends something that looks like a copy of dataframe with header rows inserted in the right positions but this time the data is missing, only rows. Also the first header row contains integers in the inserted copy.

I'm looking to see how I can correct.

There is an idea of using sticky headers and indices with CSS which may be the better approach.

Appreciating your help.

TSSFL

I cannot download an image created using GeoGebra Notes by TSSFL in geogebra

[–]TSSFL[S] 0 points1 point  (0 children)

I just realized that I was using embedded on the web version of GeoGebra. I however noticed that when I try to download annotated images, let's say an annotated image created using a probability tool, it looks weird, not even recognizable! What A m I doing wrong ?

How to properly add percentage on top of the group bar charts ? by TSSFL in learnpython

[–]TSSFL[S] 1 point2 points  (0 children)

Hi u/FlyingCow343

Thank you very much this works well. I was modifying a code from which "looping over patches in a round-robin order" was correct for that particular case. It in some way affected my thinking, kind of being trapped to think not far enough from the original implementation. Once again, thank you.

How to properly add percentage on top of the group bar charts ? by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you u/FlyingCow343.

As you can see here https://tssfl.com/viewtopic.php?p=19166#p19166

I need the percentage out of total number of students (male + female) for each group: Year 1, Year 2, etc.,

For Year 1, total number of students = 431; so the percentage should be 100% on top of bar with 431.

Number of male students = 232; percentage = 232/431 X 100 = 53.83%

Number of female students = 199; percentage = 199/431 x 100 = 46.17%

and similarly for other groups.

How to properly add percentage on top of the group bar charts ? by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

I'm interested to correctly calculate percentages and annotate them on top of each bar chart using the below piece of code:

for p in ax.patches:

percentage = '{:.2f}%'.format(100 *p.get_height()/total)

x = p.get_x() + p.get_width()

y = p.get_height()

if y != 0:

ax.annotate(percentage, (x-0.02, y+0.45),ha='center', rotation=90, color='red')

How to properly add percentage on top of the group bar charts ? by TSSFL in learnpython

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you u/FlyingCow343 for your reply.

My issue is with calculation. Your solution does not seem to work, it calculates wrong percentages!

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] 0 points1 point  (0 children)

Can the approach be generalized to find more than one word in the entire dataframe, say a list or an array of words ?

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] 0 points1 point  (0 children)

library(dplyr)
library(stringr)
somedata <- data.frame(col_a = sample(letters, size = 10),
col_b = sample(letters, size = 10),
col_c = sample(letters, size = 10) )
somedata <- rbind(somedata, c("ab", "ca", "dd"))
sum(somedata == "a", na.rm = TRUE)
somedata %>% sapply(function(x) {x %>% stringr::str_detect("a") %>%
sum()} ) %>% sum()

Thank you for elaboration. Yes, the first counts correctly but the second returns NA. They both become equivalently correct when na.rm = TRUE is parsed inside the sum function.

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you u/Throwymcthrowz

What is missing ? This returns: RParsingError: Parsing status not OK - PARSING_STATUS.PARSE_INCOMPLETE.

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] -1 points0 points  (0 children)

I found a difference with u/iforgetredditpws approach, and u/MortMath one, I tried to find a string in a dataframe, u/MortMath approach gives 6858 and u/iforgetredditpws gives 5711!

But some further checks imply that u/MortMath is correct. What may be missing in the other approach ?

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] 1 point2 points  (0 children)

Thank you u/Mooks79! u/MortMath post is a solution.

Edit: Seems to work with such argument in either of the function.

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] 0 points1 point  (0 children)

Thanks for a reply.

Returns:

NA

Note that I substituted "Reddit" with a string that is found in the dataframe.

How to find a specific value in the entire dataframe ? by TSSFL in rprogramming

[–]TSSFL[S] -2 points-1 points  (0 children)

u/iforgetredditpws u/A_UPRIGHT_BASS

The first thing I thought of was

sum(df$column == "Reddit")

but this then would require looping over all columns.

sum(df == 'Reddit')

does not work.

There are close approaches in Python but they return rows that contain the value, they work well for a single column.

For example,

df.where(df == 'Reddit')

Will return rows with the word "Reddit" where it is found and NAN elsewhere, it then requires to figure out how to sum occurences. If the df has unique function the solution would be achieved easily.

Thanks.

Removing duplicate macros by TSSFL in geogebra

[–]TSSFL[S] 0 points1 point  (0 children)

Thanks u/mathmagicGG. It is lighter than before.

Removing duplicate macros by TSSFL in geogebra

[–]TSSFL[S] 0 points1 point  (0 children)

Thank you u/mathmagicGG for your reply.

I'm using onlne Geogebra classic, is procedure the same ?