Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Removing leading whitespaces
Post: Removing leading whitespaces
Hi all
I am trying to build a simple (semi) live dictation script with Whisper. As Whisper do not support commands out of the box (eg 'new paragraph') I would need to catch these. I am using the
k... |
|
palladium |
General Coding Help |
1 |
727 |
Mar-24-2023, 12:56 PM |
|
|
Thread: How do I instantiate a class with **kwargs?
Post: RE: How do I instantiate a class with **kwargs?
(Feb-15-2023, 04:21 PM)deanhystad Wrote: Consider not doing that. What is your use case for a class that creates different instance attributes based on the named arguments passed to __init__()?
Bu... |
|
palladium |
General Coding Help |
6 |
7,395 |
Feb-16-2023, 02:08 PM |
|
|
Thread: How do I instantiate a class with **kwargs?
Post: How do I instantiate a class with **kwargs?
Consider the following:
class TestClass():
def __init__(self, param_1 , **kwargs):
self.param_1 = param_1
#?? how do I initialise the **kwargs??
#self.**kwargs = **kwarg... |
|
palladium |
General Coding Help |
6 |
7,395 |
Feb-15-2023, 02:17 PM |
|
|
Thread: Problem: Check if a list contains a word and then continue with the next word
Post: RE: Problem: Check if a list contains a word and t...
Sounds like you are trying to filter out bad words and bad words only. If that is the case, regex is probably the way to go. I made the following snippet (warning: may content offensive material, but ... |
|
palladium |
General Coding Help |
2 |
2,509 |
Aug-12-2021, 04:25 PM |
|
|
Thread: Picking a function to execute
Post: Picking a function to execute
I want to add moving averages of prices and volume of various periods of the DJIA index. The code below works:
import pandas as pd
mydata = pd.read_csv('djia.csv', index_col = 'Date')
what_dict = {... |
|
palladium |
General Coding Help |
1 |
1,618 |
Feb-09-2021, 02:25 PM |
|
|
Thread: Problem with pandas
Post: Problem with pandas
Sample data:
Output:business_name
john chin elementary school
sutter pub and restaurant
sri thai cuisine
washington bakery & restaurant
brothers restaurantThe goal is to filter out which of these ... |
|
palladium |
General Coding Help |
0 |
1,343 |
Jan-08-2021, 12:54 AM |
|
|
Thread: Converting .txt to .csv file
Post: RE: Converting .txt to .csv file
(Jan-01-2021, 07:48 AM)SunWers Wrote: (Jan-01-2021, 07:41 AM)buran Wrote: can you upload sample input file? Looking at the screenshot again, it is more likely a fixed-width file.
Sorry, crazy ques... |
|
palladium |
General Coding Help |
21 |
12,124 |
Jan-01-2021, 07:56 AM |
|
|
Thread: Converting .txt to .csv file
Post: RE: Converting .txt to .csv file
(Jan-01-2021, 07:31 AM)SunWers Wrote: (Jan-01-2021, 06:52 AM)palladium Wrote: Easiest way to find out is to print out the dataframe and see how many columns you get. I can't see any ';' delimiters... |
|
palladium |
General Coding Help |
21 |
12,124 |
Jan-01-2021, 07:53 AM |
|
|
Thread: Converting .txt to .csv file
Post: RE: Converting .txt to .csv file
(Jan-01-2021, 06:29 AM)SunWers Wrote: I'm thinking it's because of this part of the code with the ;
Easiest way to find out is to print out the dataframe and see how many columns you get. I can't se... |
|
palladium |
General Coding Help |
21 |
12,124 |
Jan-01-2021, 06:52 AM |
|
|
Thread: How to rearrange DataFrame ?
Post: RE: How to rearrange DataFrame ?
Can you please post the code and a sample of your csv file |
|
palladium |
Data Science |
1 |
1,706 |
Jan-01-2021, 04:14 AM |
|
|
Thread: Newbie Help with Datetime formats and numPy
Post: RE: Newbie Help with Datetime formats and numPy
See this SO post:
https://stackoverflow.com/questions/3191...with-numba
Essentially pandas store all datetimes in datetime64[ns] format only (i.e. down to nanoseconds), but busday_count requires dat... |
|
palladium |
Data Science |
2 |
5,801 |
Dec-31-2020, 03:00 PM |
|
|
Thread: Comparing results within a list and appending to pandas dataframe
Post: RE: Comparing results within a list and appending ...
Can you post a runnable code with a subset of your data, and the complete traceback? |
|
palladium |
Data Science |
1 |
2,355 |
Dec-17-2020, 01:08 PM |
|
|
Thread: Getting the hourly average of a time series dataset
Post: RE: Getting the hourly average of a time series da...
Your time stamps have a trailing white space at the end just before the comma. After removing the trailing white spaces the error goes away. |
|
palladium |
General Coding Help |
10 |
12,577 |
Dec-15-2020, 12:51 PM |
|
|
Thread: Getting the hourly average of a time series dataset
Post: RE: Getting the hourly average of a time series da...
I plugged in the problematic string you pointed out into my csv file and it worked for me.
Can you post the entire traceback?
Also, check that your csv file is formatted like your OP post, but with... |
|
palladium |
General Coding Help |
10 |
12,577 |
Dec-15-2020, 09:31 AM |
|
|
Thread: Analyzing yearly expenses (CSV file) from debit card
Post: RE: Analyzing yearly expenses (CSV file) from debi...
(Dec-13-2020, 02:42 PM)Python_User Wrote: Yes I am using Excel to display the csv file. Openpyxl is only for reading Excel xlsx, xlsm, xltx and xltm files I thought?
It can do formatting too:
https:... |
|
palladium |
Data Science |
4 |
2,646 |
Dec-14-2020, 03:20 PM |
|
|
Thread: Analyzing yearly expenses (CSV file) from debit card
Post: RE: Analyzing yearly expenses (CSV file) from debi...
Are you trying to build a pivot table? pandas has support for them, though I must admit I haven't use it before.
Formatting cells (e.g. changing fonts to bold) , assuming you are using Excel to disp... |
|
palladium |
Data Science |
4 |
2,646 |
Dec-13-2020, 02:29 PM |
|
|
Thread: How can this for loop work without : ?
Post: RE: How can this for loop work without : ?
It is called dictionary comprehension. Basically the code is roughly equivalent to:
def find_all_longest_words(dirname):
dict = {}
for filename in os.listdir(dirname):
if os.path.isfile(o... |
|
palladium |
General Coding Help |
1 |
1,702 |
Dec-13-2020, 01:19 AM |
|
|
Thread: Building a food delivery program
Post: RE: Building a food delivery program
(Dec-06-2020, 01:26 PM)ElenaPapagia Wrote: 3 - Orders
Create an Order class to manage orders from customers
An order should have an id, a meal_id (which is the is for the meal ordered), and a custom... |
|
palladium |
Homework |
2 |
4,783 |
Dec-12-2020, 12:00 PM |
|
|
Thread: How to run parallel command (same command -ping)
Post: RE: How to run parallel command (same command -pin...
Asyncio might be your best bet:
https://docs.python.org/3/library/asyncio.html |
|
palladium |
General Coding Help |
3 |
2,830 |
Dec-12-2020, 11:04 AM |
|
|
Thread: Help with a ValueError
Post: RE: Help with a ValueError
See here: https://pandas.pydata.org/pandas-docs/ve...tchas.html
and here: https://stackoverflow.com/questions/3692...em-a-any-o
A little hard to give specific advice without knowing what you are try... |
|
palladium |
General Coding Help |
4 |
2,959 |
Dec-12-2020, 07:24 AM |