Yes, I agree that it is inefficient to keep posting issues as it appears and I am new to Python. The datasets that I am dealing with are often formatted in different ways so I have to be comfortable with being able to manipulate them according to my needs. I have done a few courses but I find...
Hi, I don't believe my questions were similar as I am dealing with a different dataframe at every point with specific problems that I cannot expect in advance. I am learning while working on these different datasets but I realize that I may be asking too many questions here and to actually have...
I am trying to drop the series size so that it matches the size of the dataframe as I need to copy the index value of the series into the df but I am getting mismatch errors. df has a size of 100 but time has a size of 200 so I want to remove the extra rows in time to match df. how can i handle...
I have a dataframe that looks as attached. What I aiming to do is to plot the lines for each type where if it is for type A, I want to be able to have two lines in the graph that shows the trend for type A. I was not able to find any examples online especially with the format of the data in this...
sorry, i thought the tag would show python and yes it is in python. but these timestamps are within the row itself and i have several hundred rows with this data inside each. i thought of doing it in python so that i can read the file and plot a chart for each.
i have a dataset that has the timestamp data within each row and I am trying to plot the values to see the distribution but have no idea how to do it if the data is presented this way as attached. any ideas? thanks
i wanted to do it this way so that i can select the columns that could be in other position in the dataframe:
cols = ['a', 'b', 'c', 'd'']
sum(row[cols].count("no_label") < 2 for row in df)
but it gives me this error :
TypeError: string indices must be integers, not list
what can i do to...
thank you for this suggestion. but what if i only want to check from these columns a,b,c, and d? as I have other columns e,f,g that also has the 'no_label' value but I don't want to consider them,
I am trying to count number of rows that has values in at least 3 columns so the output based on the image shared should be 4. I tried using the code below but it is resulting in the same shape as the whole table which is 7.
counts = df[(df[['a', 'b', 'c', 'd]] != 'no_label').count(axis=1) >= 3]
below is the complete code considering when there are no duplicates and with duplicates. i would welcome suggestions on how to shorten this whole if else loop :)
# if list does not have duplicate values
if majority != 0 and (len(list_maj) == len(set(list_maj))):
if counter_a == majority...
it is funny that when i tried this very same code on a windows platform it did not give me any problem but when i ran it on a ubuntu platform, it will just not read that 0.600000001 as the maximum value