how to simply iterate column values?
See original GitHub issueHi Ilya,
I wonder if there is a simple way to iterate specific columns of a table as an alternative to the following implementation (based on pysnmp v4.4.4)?
@property
def _notification_targets(self):
snmpNotifyEntry, = self.instrum.getMibBuilder().importSymbols('SNMP-NOTIFICATION-MIB', 'snmpNotifyEntry')
varBinds = initialVarBinds = (
(snmpNotifyEntry.name + (1,), None),
)
while varBinds:
varBinds = self.instrum.readNextVars(varBinds)
name, val = varBinds[0]
if exval.endOfMibView.isSameTypeWith(val):
break
if name[:len(initialVarBinds[0][0])] != initialVarBinds[0][0]:
break
yield str(val)
A simpler and faster method would be the following:
@property
def _notification_targets_not_public(self):
snmpNotifyName, = self.instrum.getMibBuilder().importSymbols('SNMP-NOTIFICATION-MIB', 'snmpNotifyName')
for oid, val in snmpNotifyName._vars.items():
yield str(val.syntax)
However, a protected class member is accessed here.
I would appreciate comments or alternative recommendations.
Best regards, Andreas
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Iterating over rows and columns in Pandas DataFrame
In order to iterate over rows, we use iteritems() function this function iterates over each column as key, value pair with the label...
Read more >Pandas Iterate Over Rows with Examples
Like any other data structure, Pandas DataFrame also has a way to iterate (loop through row by row) over rows and access columns/elements...
Read more >Loop or Iterate over all or certain columns of a dataframe
Iterate over columns in dataframe using Column Names. Dataframe.columns returns a sequence of column names. We can iterate over these column names and...
Read more >How to Iterate Over Columns in Pandas DataFrame - Statology
We can also use the following syntax to iterate over every column and print just the column names:.
Read more >How to Iterate Over Rows in a Pandas DataFrame - Stack Abuse
In the for loop, i represents the index column (our DataFrame has indices from id001 to id006 ) and row contains the data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds like if there was a getSubtrees() method/property alongside registerSubtrees(), that would solve this…
Meanwhile, could you walk
snmpNotifyEntry
subtree by calling snmpNotifyEntry.getNextNode(name) starting with name=snmpNotifyEntry.name?Meanwhile…
Unfortunately, the use of the
.syntax
object/property is not appropriate because of the multi-phase procedure for creating/writing. For now, I will continue with the usual suspects.readGet()
/.writeCommit()
.