• 0
Sign in to follow this  
Daniel Bandeira

TypeError: importPoisson() takes 1 positional argument but 2 were given

Question

Galera, estou tentando importar de um arquivo externo alguns dados para poder gerar um gráfico e tal, mas toda vez da esse erro, segue meu código:


Também podem falar erros que vocês acharam no meu código que pode ser melhorado, estou iniciando em Python ainda e gostaria de aprender também

 

import matplotlib.pyplot as plt

class poisson():

    def __init__(self):
        stopTimes = []
        times = []
        self.stopTime = stopTimes
        self.times = times

    def importPoisson(enterArchive):
        database = open('import/'+enterArchive+'.csv', 'r')

        for count in database:
            count = count.strip()
            stop,time = count.split(',')
            poisson.stopTimes.append(stop)
            poisson.times.append(time)

        return poisson.stopTimes, poisson.times

    def plotGraphic(self):
        plt.title("Poisson")
        plt.step(poisson.times, poisson.stopTimes, label="Paradas de carros")
        plt.legend()
        plt.xlabel("Tempo")
        plt.ylabel("Paradas")
        plt.show()

pos = poisson()

pos.importPoisson("eventEntrance")
pos.plotGraphic()

 

Segue em anexo um print de quais são os dados de entrada

dados.PNG

Edited by Daniel Bandeira

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this