« first day (3935 days earlier)      last day (1003 days later) » 

2:47 AM
cbg
 
 
4 hours later…
6:21 AM
cbg
 
 
1 hour later…
7:23 AM
hello
 
Hello
 
 
2 hours later…
9:53 AM
@PallabTewary please don't ask for help here with fresh questions on the main site as per our rules
 
10:52 AM
Hello I am getting error in moviepy text animation. This code works but when concatenating two clips its through error.
 
@OhmDios please see our room rules and post larger blocks of code offline and link back here. Also in your post, please include the full traceback and not just the error itself
Sorry, off-site. Got "offline" on the brain from a package I'm working on :/
 
Okay Thanks For Response, I updated my knowledge on posting larger block of codes and added full trace back here.
https://dpaste.com/C7FYX5CRN
@roganjosh thanks updated my question.
 
11:11 AM
The docs show that concatenate_videoclips expects (at least) a VideoFileClip object and you're just supplying lists from list comprehensions
The relevant source code
Does this work? final_clip = concatenate_videoclips(clips=clip1 + clip2,method="compose")?
 
Hi everyone
I am trying to implement a singleton class for a MongoDB connection. I was able to implement the class but I am having confusion on how to pass mongo shell queries as arguments to one of the methods defined(execute_mongo_query_and_return_dataframe). Here is the MCVE: pastebin.com/jKzZebH1
Can someone help me in this?
I need help on how to pass the mongo shell query and how to structure the argument for the associated method
 
@roganjosh @roganjosh Perfect. Thanks a Lot. Working.
 
Glad to hear it :)
 
 
1 hour later…
12:48 PM
@AndrasDeak I was asked on the site but was not getting a proper answer thats why i was asking here
 
1:25 PM
@PallabTewary you're not expected to get a proper answer within 2 hours of asking the question, especially on a weekend
 
 
1 hour later…
2:53 PM
Hello Guys, I am having issue with this code. Code works well. But letters with dot not works like i,j.
tried with different font style but no use same result.
 
Do you mind providing the code that you have (it sounds like the code to which you linked isn't exactly what you have) and examples of your output so that we can be more clear as to what you're looking at?
 
3:10 PM
sure i will update later in detail Thanks.
 
3:24 PM
Not quite sure how to to turn a dataframe like this: df = pd.DataFrame({'a': ['Apple', 'Dog', 'Mouse', 'Apple']}, {'Date Today': pd.date_range(start='1/10/2021', '1/14/2021'), 'Value':[1,2,3,4,5,6,7]}
Into something like this
start_date = ['2021-01-10', '2021-01-11', '2021-01-11', '2021-01-11', '2021-01-14', '2021-01-14', '2021-01-15']
end_date = ['2021-01-13', '2021-01-14', '2021-01-15', '2021-01-16', '2021-01-15', '2021-01-16', '2021-01-16']
a = ['Apple', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog']
Growth = [5,7,8,9,11,12,13]
df_new = pd.DataFrame({'Start Date':pd.to_datetime(start_date), 'End Date':pd.to_datetime(end_date), 'a':a, 'Growth':Growth})
Really been trying to come up with a way to populate all the date combinations later than a certain date then sum the values
I can probably come up with something but when there's so much steps involved I feel i'm doing it inefficiently like looping through a dataframe
 
3:47 PM
@Pherdindy your first code line (the input df) seems to have errors in it, i can't run it
 
df = pd.DataFrame({'a': ['Apple', 'Dog', 'Mouse', 'Apple', 'Dog', 'Dog', 'Dog'], 'Date Today': pd.date_range(start='1/10/2021', end='1/16/2021'), 'Value':[1,2,3,4,5,6,7]})
Whoops real sorry copied the previous line from the console
 
so, is the list of start_date , end_date and a stuff you're also giving as input? and you just want to calculate growth against those?
 
That's the output dataframe I can't seem to come up with how to make it look like that
 
given your input df, what's deciding what the date ranges and "a" will be?
ie. either these lists are also part of the input, or you are using some other criteria to decide what "date ranges" become part of outputs, which you need to describe.
 
Any date later than the start date is going to be allocated a row in the output df
So for each 'a' element if that makes sense
It's all the combinations that is present in the input df
except that the end date cannot be before the start date
and if there is only 1 data point then it should exclude from the output df since there is no 'growth'
 
4:02 PM
ah, i get it.
 
I was thinking of using .isin but the multiple criteria for the indexing is making me have a tough time
 
at this stage, i'd say the logic is complex enough that my first instinct would be to say that loops are fine. though not through the df necessarily.
now, why is your output df 2021-01-11 2021-01-16 Dog 9 having a value of 9 for those date ranges for the Dog?
 
It's the sum of the the Value column from the start_date and end_date
 
wait.. it doesnt include the dates in between?
ie. why is it not 20
 
Nope unfortunately my data extraction is not daily so I have gaps in my data
 
4:10 PM
oh ok
 
ello
 
It's just a sample data set I encoded with hand so the values may not make sense hah but realistically it should be all linked together (the values)
@ParitoshSingh each row from the input df is a snapshot rather so the growth calculations should be in the real data subtracting the values (7-2). But in this case it didn't have context so I just did (7+2)
 
4:37 PM
this was what i came up with, should get you started.
 
@ParitoshSingh thanks when it comes to dataframes I always felt I was doing something wrong when I had to loop and try to come up with another solution so I guess it paralyzes me
 
i have a simple philosophy. Solve first. improve later.
there's no point trying to think of an optimal solution without even "a" solution.
 
Right any working solution is better than none for sure hah. Thanks
 
aye, and you find that the process of solving it through once can also help you when you try to improve on it. :)
 
 
1 hour later…
5:53 PM
I don't understand the output for 2021-01-14 2021-01-16 Dog 12 @Pherdindy . Why is it not cumulative and include the value on 2021-01-15?
 
@roganjosh it's similar to measuring your weight over time where each person takes their weight every day you subtract your most recent weight to your starting weight
 
Which makes sense. But you've made some comment about "But in this case it didn't have context so I just did (7+2)" which is the opposite
To me, that makes the problem harder to solve because you're now summing pairs, which throws the context
Your expected output now says that there is more growth between 2012-01-15 to 2012-01-16 than there was between 2021-0-14 to 2021-01-16. That doesn't make sense
 
I don't know why I added them when it was simple to just subtract to really represent the difference. I just felt the formula wasn't important initially but realized after posting it was in fact confusing if you really thought of it hah
At the same time I could've labeled it something like 'Sum' :/
 
The formula is crucially important. You need some cumsum approach, but it's not clear how to do the aggregation. At the moment, I don't see how I can approach the problem
If you reformulate the problem in an expected example that makes sense in your context, you might even see the solution yourself. As it stands, this example looks nonsensical in terms of what you're probably actually trying to do
 
I couldn't see how to get to the final df so in my head the difference was just a + or - the tough part for me was really the boolean indexing that matches all the criteria
Also the output df was just a starting point for the type of analysis/visualizations i'd make not sure if enumerating each combination was even needed
 
6:07 PM
You're missing my point. I don't think the expected output you listed really is what you could want
 
Basically my dataset is something you see in Amazon.com where I extract the price and review and etc of each listing
 
Take your own analogy. You're now telling me that something is growing day-by-day and your expected output is saying that something grew more in one day than it did between the day before and the same end date
 
I calculated revenues based on the product of the two to give me an estimate
 
So, two days of growth is less than 1, whilst covering the same period
 
Actually I think I get what you mean but the 'a' column of the input df
Is an important factor to the aggregation of the values
 
6:10 PM
I don't care about a, that's a category
You're telling me that your dog grew more cumulatively between 2021-01-15 to 2021-01-16 than it did between 2021-01-14 to 2021-01-16. That's not possible
 
Yes but I aggregate the growth per category so in my case I exclude the values of 'Apple' and 'Mouse' rows
Cause i'd want to track something like the iPhone6 in amazon over time and i'd also want to track samsung galaxy S7 for instance
 
This is getting frustrating. Can you please re-read what I'm saying?
 
Right I get what you mean I did note I made a mistake on adding instead of subtracting I should've labeled the growth column as a sum or something else
Realized how important the context was earliest when talking with Paritosh
 
Then please reformulate your example to give what you actually want, because this really isn't what you want but you're asking us to solve it
People are happy to solve problems with suitable examples, but you have to at least make sure that the example, expected output, is sane
 
start_date = ['2021-01-10', '2021-01-11', '2021-01-11', '2021-01-11', '2021-01-14', '2021-01-14', '2021-01-15']
end_date = ['2021-01-13', '2021-01-14', '2021-01-15', '2021-01-16', '2021-01-15', '2021-01-16', '2021-01-16']
a = ['Apple', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog']
Sum = [5,7,8,9,11,12,13]
df_new = pd.DataFrame({'Start Date':pd.to_datetime(start_date), 'End Date':pd.to_datetime(end_date), 'a':a, 'Sum':Sum})
I believe this should be much less confusing I labeled incorrectly
 
6:18 PM
... you need to study your own output here. It isn't what you want. I don't think you've thought about this problem enough
It doesn't tell you growth between the start and end date at all. It is nonsense in the context of your example. Think about what that output actually tells you if this was monitoring your dog's growth
 
Hi
I'm trying to connect to cx_oracle and executing queries using following syntax:

conn = creating the connection to oracle
c = conn.cursor()
for query in queries:
c.execute(query)
list2.append(c.fetchall)
c.close()
conn.close()
When running these queries, sometimes, they'll get stuck and when pressing any key, they'll continue running. and then may/may not get stuck again
 
start_date = ['2021-01-10', '2021-01-11', '2021-01-11', '2021-01-11', '2021-01-14', '2021-01-14', '2021-01-15']
end_date = ['2021-01-13', '2021-01-14', '2021-01-15', '2021-01-16', '2021-01-15', '2021-01-16', '2021-01-16']
a = ['Apple', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog', 'Dog']
difference = [3,3,4,5,1,2,1]
df_new = pd.DataFrame({'Start Date':pd.to_datetime(start_date), 'End Date':pd.to_datetime(end_date), 'a':a, 'Growth':difference})
I believe this should be the exact representation
 
@DeepakVerma I think this question has died a death. You keep bringing it up and we can't get to the bottom of it. I think you'll need to go to someone internal; preferably someone that has access to the DB itself that can monitor logs
 
okay, thanks @roganjosh
 
@Pherdindy thank you! That does indeed look like what I think you'd expect. I'll pick it up shortly unless someone else does in the meantime
 
6:27 PM
@DeepakVerma and while we're at it, please look at our code formatting guide to chat. Or paste code into a code paste service and link here.
 
sure, thanks
 
@roganjosh thanks for the help although Paritosh already sent a starting ground earlier which i'll see if there are changes i'll need to make
import pandas as pd
​
​
df = pd.DataFrame({'a': ['Apple', 'Dog', 'Mouse', 'Apple', 'Dog', 'Dog', 'Dog'],
                   'Date Today': pd.date_range(start='1/10/2021', end='1/16/2021'),
                   'Value':[1,2,3,4,5,6,7]})
​
​
def calculate_growth_pairwise(df_subset):
    if len(df_subset) < 2:
        return pd.DataFrame()
    out = []
    for idx in range(1, len(df_subset)):
        shifted = df_subset.shift(idx)
        shifted.rename({'Date Today': 'Start Date'}, axis=1, inplace=True)
 
7:10 PM
I do hope you never control my investment portfolio or anything like that
 
7:27 PM
cbg
 
 
1 hour later…
8:36 PM
Does anyone have thorough knowledge of setuptools, and python packaging?
 
It's probably best if you just ask the question, instead of asking people to commit to a question they haven't had a chance to ponder.
 
Ok. I'm trying to package a project that i have. I'm fairly new to setuptools. Basically, I need to use user input (best way i can think of is via command line) to specify which packages/folders in my project should be included in the build/distribution. I tried using the Command class in the setuptools library to create a custom command, but the command only runs after the package is already built.
s
My structure is as follows:
Src folder
--package1
--package2
--package3
--init.py
setup.py (not in the src folder, in the root folder)
Also other necessary files like pyproject.toml etc in the root folder
my Setup.py folder has the following code:
 
8:58 PM
Ummm, why do you need user input to decide which files to include?
This problem sounds an awful lot like "I need the customer to tell me which parts of the car they want to buy"... usually you'd sell them the whole dang car, no?
 
@CodeBoi that's both unformatted and too much code for chat. Please use a code paste site, and for future reference see our formatting guide to chat.
 
Yeah my thought process was the same, but apparently thats what my boss wants from me. I've tried everything i could think of, but im stuck. Hoping you guys can help me out.
 
9:20 PM
I'm not familiar with setuptools, but as a last resort you can always manipulate sys.argv...
 
And you can always use some logic to set up the call to setuptools.setup, I imagine
 
Yeah, that's what I meant. Inspect sys.argv, set packages accordingly, and then remove the arguments that setuptools doesn't understand from sys.argv
 
I didn't even mean that. Surely this isn't expected to work as python setup.py install potato. Have a helper that does this.
I guess that might be too naive
I think there's actually machinery in setuptools to install optional extensions, I wonder how hard it is to convince the boss to use that instead :P
 

« first day (3935 days earlier)      last day (1003 days later) »