Posts by Laurinda Souza • 291 points
10 posts
-
2
votes0
answers47
viewsQ: "Attributeerror: classifierFinal' Object has no attribute 'log_softmax" when trying to train a neural network using pytorch
I’m learning to use the pytorch and I’ve stumbled upon the mistake that won’t let me continue. My code: import pandas as pd import numpy as np import torch.nn as nn from skorch import…
-
0
votes1
answer124
viewsQ: How to get a person’s friends and followers on Twitter using the tweepy library?
The function getting_friends_follwers() below works if I remove the value 100 from (cursor2.items(100)) . My goal is to take these names (followers and friends) and save in a file "friends.txt". The…
-
1
votes1
answer173
viewsQ: Bucket Sort in Python: The array is only partially ordered!
I’m trying to implement the algorithm Bucket Sort. The code below implemented only "1 round" (considering the numbers from right to left) of the algorithm, in which the array [97,3,100] turned into…
-
0
votes1
answer48
viewsQ: Error " Indirect fixture" when using pytest with a python factorial function
I’m studying recursion and automated testing and decided to implement a recursive factorial: def fatorial(n): if n <= 1: return 1 else: return n*fatorial(n - 1) import pytest…
-
4
votes2
answers79
viewsQ: Using functional programming features to remove a word list from another list
I am analyzing a literary text and am having the following problem to remove a group of words from the text. These are not repeated words. link_words are words that will disturb a later analysis of…
-
3
votes2
answers399
viewsQ: Extracting words from a long text and creating statistics on them. What’s wrong?
We have the book "Pride and Prejudice by Jane Austen" of the project Gutenberg: http://www.gutenberg.org/ebooks/1342 The goal is to extract all the words of the text, creating statistics such as:…
-
1
votes1
answer730
viewsQ: Read a JSON file and print the data in tabular format
The file is "grids.json", whose structure is: {"students": [{"name": "Alan", "lastname": "Silva", "exam1": 50, "exam2": 80, "exam3": 91}, {"name": "Paula", "lastname": "Souza", "exam1": 95, "exam2":…
-
2
votes2
answers96
viewsQ: Why does readlines display an empty list even with the file having data?
f = open("grades.txt", "r") for record in f.readlines(): print(f"grade : {record} ") print(f"readlines: {f.readlines()}") f.close() The.txt grid file exists and has the following content: 10 9.8 .6…
-
1
votes1
answer101
viewsQ: Data munging with python
Are the following date formats: 042555 04/25/1955 Abril 25, 1955 How to use regex to transform a date format into each other (would be 6 transformations)? For example: Entrada: 042555 Saída:…
-
2
votes0
answers45
viewsQ: Using the sysstat utility to save server usage information in XML format
Sysstat allows you to collect all the information I need from the server: CPU usage, memories, buffers... sadf - with the -x option prints in XML format. I would like all information (CPU usage,…