Python Forum
Create a Table to a PNG file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a Table to a PNG file
#1
Hi

I am trying to create a table with the vaccine lot number and cardiovascular adverse events. I want to have a table where I have the values in descending order, with a limit of 15 in the table. The columns need to have VAX_MANU, VAX_LOT, and total number of cardiovascular adverse events per specific lot number.

VAX_MANU and VAX_LOT is part of the original dataset so I am trying to find the most documented lot number for any manufacturer (Pzifer, Moderna, Johnson & Johnson) and then creating a table that has VAX_MANU, VAX_LOT and the frequency

This is my code:

## Understand value_counts()

covid_vaers_cardio['VAX_LOT'].value_counts()

## Create a count for all the Lot Numbers

total_number = covid_vaers_cardio['VAX_LOT'].value_counts()

## Create a table

covid_vaers_lot = covid_vaers_cardio[['VAX_MANU', 'VAX_LOT', 'total_number']]

Error: KeyError: “[‘total_number’] not in index”

Another attempt:

## Understand value_counts()

covid_vaers_cardio['VAX_LOT'].value_counts()

## Create a count for all the Lot Numbers

total_number = covid_vaers_cardio['VAX_LOT'].value_counts()

## Create a table

covid_vaers_lot = covid_vaers_cardio['VAX_MANU'].merge(total_number, how='outer')
Error:
AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_18536/3237736396.py in ----> 1 covid_vaers_lot = covid_vaers_cardio[‘VAX_MANU’].merge(total_number, how=‘outer’) ~\anaconda3\lib\site-packages\pandas\core\generic.py in getattr(self, name) 5485 ): 5486 return self[name] → 5487 return object.getattribute(self, name) 5488 5489 def setattr(self, name: str, value) → None: AttributeError: ‘Series’ object has no attribute ‘merge’
This article explained what went wrong. Am I correct in saying that what I'm doing here isn't permitted on Python? If so, what other ways can I have a small table of VAX_MANU, VAX_LOT, frequency of specific lot number?
Yoriz write Aug-11-2022, 05:34 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I use bounding box to locate a table in a pdf file? JaneTan 1 2,520 Sep-01-2021, 05:44 PM
Last Post: Larz60+
  Unable to create vtu file from python tady57 2 4,638 Dec-01-2017, 09:58 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020