Python Forum
Need to return 2 values from 1 DF that equals another DF
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to return 2 values from 1 DF that equals another DF
#1
ok, so i have a script that pings all our registers in the company to check if they are online or offline.. this works great. that script works off a list of just ip's. Once the script runs, it generates a output file in csv with the ip, status, datetime. Currently this is being pulled into excel to create a dashboard. NOW that VP's and management is aware of this dashboard, they want access, but providing access to so many people and one excel file, the file is going to get manipulated and eventually break. So im working on a new script that i can do everything im already doing in excel, but within the script to then generate a static report that can be sent out to everyone and no worry about pivot tables being changed or excel file being updated or changed and causing issues.

So i have a dataframe that returns a list of the ip's with store # and register number (source data) in the new script, this will be used as the source for IP's to ping. So in excel im using vlookup, how can i accomplish the same thing and add the store # and Register # to my csv of results?

Here is my source data that will be used to pull the ip, but also contains the store and register that i need to include in my results.csv

# SOURCE DATAFRAME
Output:
IP Store Register 0 121.11.7.203 7 203 1 121.11.7.204 7 204 2 121.11.7.205 7 205 3 121.11.7.206 7 206 4 121.11.7.207 7 207 5 121.11.7.208 7 208 6 121.11.7.221 7 221 7 121.11.7.222 7 222 8 121.11.9.201 9 201 9 121.11.9.202 9 202 10 121.11.9.203 9 203 11 121.11.9.204 9 204
# RESULTS DATAFRAME THAT IS WRITTEN TO CSV
Output:
IP Status Datetime 0 121.11.7.203 0 10/18/2023,16:12:01 1 121.11.7.204 0 10/18/2023,16:12:01 2 121.11.7.205 0 10/18/2023,16:12:01 3 121.11.7.206 0 10/18/2023,16:12:01 4 121.11.7.207 0 10/18/2023,16:12:01 5 121.11.7.208 0 10/18/2023,16:12:01 6 121.11.7.221 1 10/18/2023,16:12:01 7 121.11.7.222 0 10/18/2023,16:12:01 8 121.11.9.201 0 10/18/2023,16:12:01 9 121.11.9.202 0 10/18/2023,16:12:01 10 121.11.9.203 0 10/18/2023,16:12:01 11 121.11.9.204 0 10/18/2023,16:12:01
Since the results are captured into a df as they are gathered, then written to csv, i would like to add the store and register into the results before writing the csv. How can i search the source for the ip and return the 2 additional values i want and add to the results df?
Reply


Messages In This Thread
Need to return 2 values from 1 DF that equals another DF - by cubangt - Oct-20-2023, 02:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved]Return values from npyscreen Extra 2 1,253 Oct-09-2022, 07:19 PM
Last Post: Extra
  Parallelism with return values Plexian 7 1,628 Aug-14-2022, 09:33 AM
Last Post: Plexian
  please help with classes and return values jamie_01 5 1,906 Jan-17-2022, 02:11 AM
Last Post: menator01
  Need to parse a list of boolean columns inside a list and return true values Python84 4 2,237 Jan-09-2022, 02:39 AM
Last Post: Python84
  Function - Return multiple values tester_V 10 4,719 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Function to return list of all the INDEX values of a defined ndarray? pjfarley3 2 2,050 Jul-10-2020, 04:51 AM
Last Post: pjfarley3
  What is the best way to return these 4 integer values? Pedroski55 4 2,634 Apr-13-2020, 09:54 PM
Last Post: Pedroski55
  Return values for use outside of function willowman 1 1,735 Apr-13-2020, 07:00 AM
Last Post: buran
  Return all Values which can divided by 9 lastyle 2 1,914 Mar-16-2020, 09:22 PM
Last Post: lastyle
  Custom Function to Return Database Values rm78 0 1,831 Sep-05-2019, 01:01 PM
Last Post: rm78

Forum Jump:

User Panel Messages

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