Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: how to pass a mongdb command to a module and execute it.
Post: how to pass a mongdb command to a module and execu...

Resolved
cspower General Coding Help 0 321 Feb-03-2024, 09:54 PM
    Thread: [pandas] TypeError: list indices must be integers or slices, not str but type is int.
Post: RE: [pandas] TypeError: list indices must be integ...

(Dec-29-2023, 09:31 PM)cspower Wrote: I'm reading from an .ods file randomly selected cells. I randomly select them by the file loc(index).at('the column name') I created this list [('L', 1), ('L',...
cspower Data Science 4 886 Dec-29-2023, 10:39 PM
    Thread: [pandas] TypeError: list indices must be integers or slices, not str but type is int.
Post: [pandas] TypeError: list indices must be integers ...

I'm reading from an .ods file randomly selected cells. I randomly select them by the file loc(index).at('the column name') I created this list [('L', 1), ('L', 6), ('L', 7), ('C', 1), ('C', 6), ('C',...
cspower Data Science 4 886 Dec-29-2023, 09:31 PM
    Thread: Create Choices from .ods file columns
Post: RE: Create Choices from .ods file columns

(Dec-27-2023, 08:01 AM)Gribouillis Wrote: This code does nothing but define three functions. How can it run get_m_g() twice? Sorry I forgot to add the main() code. Still getting used to posting thes...
cspower General Coding Help 3 620 Dec-28-2023, 07:27 PM
    Thread: Create Choices from .ods file columns
Post: Create Choices from .ods file columns

The code below works however it runs the function get_m_g() twice. which takes you through the selection process a second time. How do I get the return values of the get_m_g function and pass them to...
cspower General Coding Help 3 620 Dec-27-2023, 05:57 AM
    Thread: How to access values returned from inquirer
Post: RE: How to access values returned from inquirer

(Dec-26-2023, 09:27 PM)Gribouillis Wrote: (Dec-26-2023, 09:24 PM)cspower Wrote: Error:Traceback (most recent call last): File "/home/cspower/python_projects/D_E_R.py", line 37, in <module> ...
cspower General Coding Help 6 832 Dec-26-2023, 09:34 PM
    Thread: How to access values returned from inquirer
Post: RE: How to access values returned from inquirer

(Dec-26-2023, 09:19 PM)Gribouillis Wrote: (Dec-26-2023, 08:31 PM)cspower Wrote: I've tried to run pprint(m_g) but it gives me the error "object is not callable" if I try to print it with an attrib...
cspower General Coding Help 6 832 Dec-26-2023, 09:24 PM
    Thread: How to access values returned from inquirer
Post: RE: How to access values returned from inquirer

(Dec-26-2023, 09:04 PM)menator01 Wrote: Please use bbtags to hold formatting when posting code. What is inquirer? Sorry for not using the bbtags been so long I had forgotten the protocols. Is there ...
cspower General Coding Help 6 832 Dec-26-2023, 09:16 PM
    Thread: How to access values returned from inquirer
Post: How to access values returned from inquirer

1. I'm using the code below and it works well. I'm able to select my choices but I can't figure out how to access the choices so I can use the information. I've tried to run pprint(m_g) but it gives...
cspower General Coding Help 6 832 Dec-26-2023, 08:31 PM
    Thread: Buliding a dataframe with where conditions
Post: RE: Buliding a dataframe with where conditions

(Oct-23-2020, 11:44 PM)scidam Wrote: If you need to choose rows by condition use loc instead: df = df.loc[filter_1 & filter_2] thank you that works.
cspower Data Science 2 1,942 Oct-26-2020, 01:55 PM
    Thread: Buliding a dataframe with where conditions
Post: Buliding a dataframe with where conditions

I'm trying to build a data-frame from csv file by selecting only the rows where one column is = to a string and a 2nd column has no value. The code below is supposed to only show the rows that match t...
cspower Data Science 2 1,942 Oct-23-2020, 07:18 PM
    Thread: add database rows to dataframe
Post: RE: add database rows to dataframe

The f-string is not working because it does not like some of the keywords from the sql statement. Error:Unexpected token AS RequestType,
cspower General Coding Help 7 3,256 Jan-27-2020, 09:28 PM
    Thread: add database rows to dataframe
Post: RE: add database rows to dataframe

I have also tried this syntax and it does not work either. gives a syntax error at the =. sql_query = pd.read_sql_query((SQL, conn, params = (userid, rolename)))
cspower General Coding Help 7 3,256 Jan-27-2020, 07:25 PM
    Thread: add database rows to dataframe
Post: RE: add database rows to dataframe

If I hard code the userid and rolename it works, but I need to do it with variables in the sql statment. sql_query = pd.read_sql_query((SQL, [b](userid, rolename)[/b]), conn)but the userid, rolename ...
cspower General Coding Help 7 3,256 Jan-27-2020, 02:48 PM
    Thread: add database rows to dataframe
Post: RE: add database rows to dataframe

This is the error "pandas.io.sql.DatabaseEror: Execution failed on sql" What I need to accomplish is loop through the data in a csv file. take two of the columns and use them in my sql statement, the...
cspower General Coding Help 7 3,256 Jan-24-2020, 09:55 PM
    Thread: add database rows to dataframe
Post: add database rows to dataframe

I'm trying to build a dataframe from rows I select incrementally from a database. SQL = '''select ..... where userid = ? and roleName = ?"" I use the UserId and Role Name from the file in my where cl...
cspower General Coding Help 7 3,256 Jan-23-2020, 06:37 PM
    Thread: isocalendar value converted back to start of week.
Post: isocalendar value converted back to start of week.

Is it even possible to convert the isocalendar value for the week back to the first day of the week? E.G. week 1 of 2018 converts back to Jan 1 2018.
cspower General Coding Help 1 2,549 May-30-2018, 04:34 PM
    Thread: Given a date I need to separate data into weeks
Post: RE: Given a date I need to separate data into week...

Thank You larz60 I will try your solution In the mean time can someone explain to me why this might be happening? First why doesvalues.strip() not take off the /n but cleanedData.append(datetime.strpt...
cspower General Coding Help 14 11,822 Sep-06-2017, 08:19 PM
    Thread: Given a date I need to separate data into weeks
Post: RE: Given a date I need to separate data into week...

This is the code that cleans up the data. It captures the column header 'created' a long with the date values The column header 'created' prevents me from converting the dates into datetime objects be...
cspower General Coding Help 14 11,822 Sep-06-2017, 03:14 PM
    Thread: Given a date I need to separate data into weeks
Post: RE: Given a date I need to separate data into week...

What I just discovered is the first value is the column header, the word "created" This is why the strptime fails telling me that 'created is not in the proper format. I need to remove it from the li...
cspower General Coding Help 14 11,822 Sep-05-2017, 09:26 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020