Posts by LuizAngioletti • 1,649 points
14 posts
-
0
votes1
answer76
viewsA: Rename python files using Excel list
I didn’t consider your example of code for the answer. I suggest you review the code structure. I attend to the problem defined as: Rename a list of files according to the modification date of them,…
pythonanswered LuizAngioletti 1,649 -
4
votes1
answer79
viewsQ: How to pass a dictionary to the range() function
I was looking at the documentation (docstring) of the range function and came across the following: Init signature: range(self, /, *args, **kwargs) Docstring: range(stop) -> range object…
-
1
votes3
answers11645
viewsA: Using Groupby in Pandas dataframe
The answer involves a few steps. Creating the already deduplicated Dataframe: import pandas as pd diaDuplicado = pd.DataFrame(columns=["Nome", "dia"], data=[["Pedro", 3], ["Pedro", 24], ["Antonio",…
-
9
votes7
answers7922
viewsQ: Convert an array of floats to integer
Suppose the following: import numpy as np a = np.array ( [1.1, 2.2, 3.3] ) How to convert this array to int without having to iterate each element or using another array? Why do: b = int(a) Gives an…
-
5
votes7
answers7922
viewsA: Convert an array of floats to integer
The arrays of the type numpy.ndarray has a method for type conversion: import numpy as np a = np.array( [1.1, 2.2, 3.3] ) b = a.astype('int') print b [1, 2, 3] Care should be taken, however, when…
-
21
votes5
answers8633
viewsQ: What is the most complete way to install python on Windows?
I know this question can be interpreted as an argument, so I did it with the word "complete" instead of "better". I’m a python user on GNU/Linux and here it comes more or less pre-installed. Still,…
-
7
votes1
answer3109
viewsQ: abntex2 compilation error
I’m running abntex2 to compose a graduation work. I follow the canonical model distributed by abntex2 here with some modifications to produce my work. The main modification is the separation of the…
-
15
votes3
answers1932
viewsQ: Is there a more efficient way to create an array from another array dynamically, filtering the contents of the first one?
I have an array of values that can include several numpy.Nan: import numpy as np a = np.array ( [1, 2, np.nan, 4] ) And I want to iterate over your items to create a new array without np.Nan. The…
-
1
votes1
answer2354
viewsQ: Commenting Code Blocks, Ipython Notebook
It is very annoying to have to comment line by line, and I want to join a powerful editor (like Vim) to IP-Notebook. But there must be a way to comment on code blocks in a simple way. My versions:…
ipython-notebookasked LuizAngioletti 1,649 -
2
votes1
answer2354
viewsA: Commenting Code Blocks, Ipython Notebook
To comment blocks of code, just select the lines of code you want to comment (you don’t need to select them completely, that is, until the end of the line) and press CTRL+/. The same is used to…
ipython-notebookanswered LuizAngioletti 1,649 -
31
votes1
answer29273
viewsQ: What’s the difference between break, pass and continue in Python?
The Python documentation in Portuguese is a work in progress, and reasonably confusing as you can see. I have difficulties in English and I found that website that I can’t read. So how can I use…
-
44
votes1
answer29273
viewsA: What’s the difference between break, pass and continue in Python?
If we translate the words, they give us a hint of what they actually do with the flow: break: is to break, break (or interrupt) the natural flow of the program continue: is to continue, that is to…
-
3
votes2
answers1509
viewsA: Matplotlib + Latex: Writing Text on the Axes in English
Just add another parameter to the list of previously used parameters: When using: 'text.latex.unicode' = True As below (penultimate line) in the original parameters: params = {'backend': 'ps',…
-
10
votes2
answers1509
viewsQ: Matplotlib + Latex: Writing Text on the Axes in English
Let’s start from the beginning, the versions I have are: Ipython: 1.1.0 Matplotlib: 1.3.1 Latex: pdftex 3.1415926-2.4-1.40.13 (Tex Live 2012/Debian) OS: Ubuntu 12.04 I want to plot what is below, in…