Hey Avi,
I am a long time R user now using Python. So, this is my attempt to master
the language.
The problem for me is that I often have an idea about how things are done
in R, but not sure to what functions are available in Python.
I hope that clears up some confusion.
Cheer!
On Sun, Feb 21,
I got it to work! I defined a separate function, and put it into
df['col_1'].apply().
Not the most elegant, but it worked. I'm also curious how people on this
mailing list would do it.
Cheers!
On Sun, Feb 21, 2021 at 9:21 AM C W wrote:
> I do want to follow up, if I may.
y(),
df['col_1'].apply(lambda:a int("".join(map(lambda x: str((int(x)-3)%10)
,list(str(a))
Thanks!
On Sun, Feb 21, 2021 at 9:12 AM C W wrote:
> Thanks so much everyone, I appreciate it!
>
> Ming, your solution is awesome. More importantly, very clear explanations
&
Thanks so much everyone, I appreciate it!
Ming, your solution is awesome. More importantly, very clear explanations
on how and why. So, I appreciate that.
Thanks again, cheers!
Mike
On Sun, Feb 21, 2021 at 12:08 AM <2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 2021-02-20 at 20:49:15 -0800,
Hello everyone,
I'm curious if there is a way take number and back each digit by 3 ?
2342 becomes 9019
8475 becomes 5142
5873 becomes 2540
The tricky part is that 2 becomes 9, not -1.
Here's my toy example and what I attempted,
> test_series = pd.Series(list(['2342', '8475', '5873']))
> test_se
or R, and apply it to a OOP language like Python.
On Wed, Jan 27, 2021 at 5:26 PM Irv Kalb wrote:
> On Jan 26, 2021, at 5:28 PM, William Ray Wing via Python-list <
> python-list@python.org> wrote:
> >
> >
> >
> >> On Jan 26, 2021, at 2:00 PM, C W wrote:
&g
I meant bottom right corner, not left. opps!
On Wed, Jan 27, 2021 at 3:36 PM C W wrote:
> I don't know exactly, but it shows as inspection on the bottom left corner.
>
> I believe it's indexing in the background.
>
> On Wed, Jan 27, 2021 at 3:25 PM Grant Edwards
>
I don't know exactly, but it shows as inspection on the bottom left corner.
I believe it's indexing in the background.
On Wed, Jan 27, 2021 at 3:25 PM Grant Edwards
wrote:
> On 2021-01-27, C W wrote:
> > I'm not expert in Python, but I sure tried many IDEs to kick of
I'm not expert in Python, but I sure tried many IDEs to kick off Python
programming.
I started with PyCharm, but I had a problem with it constantly scanning the
background, even after I turned that feature off.
My favorite (I'm using now) is VS Code with Python extension, it's very
light. Recentl
ts on here are approaching and debugging
this.
Bonus if no debugger or breakpoint. Just the good ol' run the function and
evaluate/print output for problems.
Thanks so much,
Mike
On Wed, Jan 27, 2021 at 10:53 AM Michael Torrie wrote:
> On 1/26/21 10:19 PM, C W wrote:
> > Tr
Hi Cameron,
Yes, you are correct in all above. There's a mistake in my copy paste.
Thanks for pointing that out!
On Wed, Jan 27, 2021 at 12:58 AM Cameron Simpson wrote:
> On 27Jan2021 00:19, C W wrote:
> >Here's the code again, class should be called PERSONDatabase,
>
27;created_at'],
KeyError: 'created_at'
Thank you very much!
On Wed, Jan 27, 2021 at 12:10 AM Michael Torrie wrote:
> On 1/26/21 8:37 PM, C W wrote:
> > I have a naive question. How do I use traceback or trace the stack? In
> > particular, I'm using VS Cod
Thanks for your replies. My apologies for the poor indent. I'm rewriting
the code below.
class NEODatabase:
def __init__(self, id, created_at, name, attend_date, distance):
self._id = id
self.created_at = created_at
self.name = name
self.attend_date = attend_date
self.distance = distance
@classme
Hello everyone,
I'm a long time Matlab and R user working on data science. How do you
troubleshooting/debugging in Python?
I ran into this impossible situation to debug:
class person:
def __init__(self, id, created_at, name, attend_date, distance):
"""Create a new `person`.
"""
self._id = id
self
Ryan Johnson wrote:
> The point that OP is trying to make is that a fixed standard that is
> distinguishable from the even-spacing Tab-length convention in code and
> text editors will establish a level of trust between the end developer and
> upstream developers or co-developers who may not have
Hello all,
I am learning the basics of Python. How do I know when a method modifies the
original object, when it does not. I have to exmaples: Example 1:
> L = [3, 6, 1,4]
> L.reverse()
> L
[4, 1, 6, 3]
This changes the original list.
Example 2:
> name = "John Smith"
> name.replace("J", j")
> nam
Hello all,
I am learning the basics of Python. How do I know when a method modifies
the original object, when it does not. I have to exmaples:
Example 1:
> L = [3, 6, 1,4]
> L.reverse()
> L
[4, 1, 6, 3]
This changes the original list.
Example 2:
> name = "John Smith"
> name.replace("J", j")
> nam
I recently posted two questions, but never got any replies. I am still
wondering if it was ever posted, or maybe the question was too trivial?
I think someone would have at least shouted if it was too trivial or
off-topic, right?
On Fri, Jun 15, 2018 at 12:03 PM, Mark Lawrence
wrote:
> On 15/06
Hi everyone,
I'm curious what data types pyplot takes. It seems that it can take numpy
series, pandas series, and possibly pandas dataframe? How many people data
types are out there? Is that true for all functions in like hist(), bar(),
line(), etc?
Is there an official documentation that lists t
Dear all,
I want find the average ratings of movies by movieId. Below is
ratings.head() of the dataset.
> ratings.head()
userId movieId rating timestamp parsed_time
0 12 3.5 1112486027 2005-04-02 23:53:47
1 1 29 3.5 1112484676 2005-04-02 23:31:16
2
m wrote:
> W dniu 10.02.2018 o 15:57, C W Rose pisze:
>> No other groups (in the limited set which I read) have the problem,
>> and I don't understand why the spammers neither spam a range of
>> groups, nor change their adddresses more frequently. It may be
>> tha
Thanks, Chris. That makes sense. The len() example is great!
On Tue, May 1, 2018 at 10:37 PM, Chris Angelico wrote:
> On Wed, May 2, 2018 at 12:22 PM, C W wrote:
> > It's interesting how mean() can be implemented, but median() will break
> > other packages.
> >
> &
tuple has
tuple methods, etc.
Now, the default way in numpy is to use function instead of methods? I'm
confused. What happened to object-oriented programming?
Thanks,
-M
On Tue, May 1, 2018 at 3:38 PM, Thomas Jollans wrote:
> On 01/05/18 19:57, C W wrote:
> > matrix.median()
Hello everyone,
In numpy, why is it ok to do matrix.mean(), but not ok to do
matrix.median()? To me, they are two of many summary statistics. So, why
median() is different?
Here's an example code,
import numpy as np
matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# find the mean
np.mean(ma
Thomas Jollans wrote:
>
> Welcome to python-list/comp.lang.python!
>
> This isn't originally a Google group. Google just mirrors the old USENET
> group, which is awash with spam.
>
> There is also a mailing list version of this group (posts are mirrored
> both ways) at https://mail.python.org/m
'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> On Sun, 01 Apr 2018 22:24:31 -0400, C W wrote:
>
> > Thank you Steven. I am frustrated that I can't enumerate a dictionary by
> > position index.
>
> Why do you care about position index?
>
> > Mayb
no <
steve+comp.lang.pyt...@pearwood.info> wrote:
> On Sun, 01 Apr 2018 20:52:35 -0400, C W wrote:
>
> > Thank you all for the response.
> >
> > What if I have myDict = {'a': 'B', 'b': 'C',...,'z':'A' }? So
I am using Python 3.6. I ran the those lines and got a sorted dictionary by
keys.
On Sun, Apr 1, 2018 at 9:38 PM, Chris Angelico wrote:
> On Mon, Apr 2, 2018 at 11:34 AM, C W wrote:
> > A different but related question:
> >
> > myDict = dict(zip(string.ascii_lowercase + s
A different but related question:
myDict = dict(zip(string.ascii_lowercase + string.ascii_uppercase,
string.ascii_lowercase + string.ascii_uppercase))
>myDict
{'A': 'A', 'B': 'B', 'C': 'C',...,'w': 'w', 'x
ay, March 31, 2018 at 4:30:04 PM UTC+5:30, bartc wrote:
> >> On 30/03/2018 21:13, C W wrote:
> >> > Hello all,
> >> >
> >> > I want to create a dictionary.
> >> >
> >> > The keys are 26 lowercase letters. The values ar
Hello all,
I want to create a dictionary.
The keys are 26 lowercase letters. The values are 26 uppercase letters.
The output should look like:
{'a': 'A', 'b': 'B',...,'z':'Z' }
I know I can use string.ascii_lowercase and string.ascii_uppercase, but how
do I use it exactly?
I have tried the foll
__init__(self, time):
self.time = time
def print_time(self):
time = '6:30'
print(self.time)
clock = Clock('5:30')
clock.print_time()
5:30
Thank you!
On Thu, Mar 8, 2018 at 6:30 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info>
Hello,
I am new to OOP. I'm a bit confused about the following code.
class Clock(object):
def __init__(self, time):
self.time = time
def print_time(self):
time = '6:30'
print(self.time)
clock = Clock('5:30')
clock.print_time()
5:30
I set time to 6:30, but it's co
nal-september.org!.POSTED!not-for-mail
> Message-ID: <4sd3le-ct4@tanner.seckford.org>
> From: C W Rose
> Newsgroups: comp.lang.python
> Subject: Spam levels.
> Date: Sat, 10 Feb 2018 14:57:40 +
> Lines: 49
> Organization: None
> Injection-Info:
I've been reading a limited range of Usenet groups since the late 1980s,
and until the recent problems in comp.lang.python had never bothered with
any sort of filtering; it's easier just to ignore people. However, the
sheer volume of spam in comp.lang.python finally defeated me, so I set up
a fil
Hi all,
I am confused why Jupyter Notebook searches files in subfolder, but PyCharm
and Sublime Text 3 does not. Is there a rule?
For example,
I have a module or file called lr_utils.py in the current folder.
If I run the following line in Jupyter, it's fine.
> import lr_utils
But in PyCharm, I
Hello all,
I am a first time PyCharm user. I have Python 3 and Anaconda installed. They
work together on Sublime Text, but not on Pycharm.
Pycharm tells me it cannot find modules numpy, matplotlib, etc.
What should I do? I tried to set the interpreter environment, and a few other
options, none s
Hello all,
I am a first time PyCharm user. I have Python 3 and Anaconda installed.
They work together on Sublime Text, but not on Pycharm.
Pycharm tells me it cannot find modules numpy, matplotlib, etc.
What should I do? I tried to set the interpreter environment, and a few
other options, none s
wow, thanks so much! I don't know how you figured that it's HTML, but
that's awesome!
Mike
On Wed, Oct 25, 2017 at 5:20 AM, Peter Otten <__pete...@web.de> wrote:
> C W wrote:
>
> > Oh, I was running a debug file, that's why the path is differen
Oh, I was running a debug file, that's why the path is different.
The file is here,
https://www.dropbox.com/s/6jx4rzyg9xwl95m/train_catvnoncat.h5?dl=0
Is anyone able to get it working? Thank you!
On Tue, Oct 24, 2017 at 10:37 PM, Dennis Lee Bieber
wrote:
> On Tue, 24 Oct 2017 18:02:26 -0700, R
Dear list,
The following Python code gives an error message
# Python code starts here:
import numpy as np
import h5py
train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
# Python code ends
The error message:
train_dataset = h5py.File('train_catvnoncat.h5', "r")
Traceback (most recen
41 matches
Mail list logo