Skip to main content

Posts

How do I compare my CSV to my config as I am iterating through each one?

Here is my code: import boto3 import pandas as pd import json s3 = boto3.resource('s3') my_bucket = s3.Bucket('bucket-name-here') def verify_unique_col(): with open(r'unique_columns.json', 'r') as f: config = json.load(f) for my_bucket_object in my_bucket.objects.filter(Prefix='decrypted/'): if my_bucket_object.key.endswith('.csv'): filename = my_bucket_object.key.split('/')[-1] for table in config['Unique_Column_Combination']['Table_Name']: unique_col_comb = config['Unique_Column_Combination']['Table_Name'][f'{table}'] df = pd.read_csv(f's3://path/to/{filename}', sep='|') df_unique = df.set_index(unique_col_comb.split(", ")).index.is_unique print(df_unique) verify_unique_col() I am trying to iterate through each CSV file in my bucket and read

Huge differences between loss functions [closed]

I have a model on TensorFlow that has 2 inputs: some text data and a set of 3 numerical values. It outputs only one single float value. Here is its structure. num_input = keras.Input(shape= (30,3), name="nums") nmlstm = layers.LSTM(128, return_sequences=True)(num_input) nmdense1 = layers.Dense(128, activation='relu')(nmlstm) nmdense2 = layers.Dense(128, activation='relu')(nmdense1) nmdense3 = layers.Dense(128, activation='relu')(nmdense2) text_input = keras.Input(shape= (30, max_sequence_length), name="text") text_vec = layers.Embedding(vocab_size, mask_zero=True, output_dim=embedding_dim)(text_input) txtds1 = keras.layers.TimeDistributed(layers.LSTM(64, return_sequences=True))(text_vec) txtds2 = keras.layers.TimeDistributed(layers.LSTM(64, return_sequences=True))(txtds1) txtds3 = keras.layers.TimeDistributed(layers.LSTM(64, return_sequences=True))(txtds2) txrspd = layers.Reshape((30, 128))(txtds3) txdense = layers.Dense(128, activation=

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: Messages

I can’t figure how to solve this error, can someone help me in detail since I’m trying to make a bot? I’m sorry if I’m dumb.. Here is the message: ⠀ ⠀ ⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀ ⠀⠀⠀ ⠀⠀⠀ ⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀ Via Active questions tagged javascript - Stack Overflow https://ift.tt/dOrgZMn

Will change of constructor's prototype influence the instantiated object?

If I have a function (constructor) with a defined prototype, let's say: function Student(name) { this.name = name; } Student.prototype.sayHello = function() { console.log(`Hello, my name is ${this.name}`); } And I instantiate and object using that function (from what I know it should set newly created object's property _prototype to the above prototype object in the moment of creation and set constructor property to Student function). const s1 = new Student('John'); s1.sayHello(); I am sure calling sayHello() would work, however, what if I change the Student 's prototype like this? Student.prototype.sayGoodbye = function() { console.log(`Goodbye, my name is ${this.name}`); } Should s1 be able to call sayGoodbye ? I've read that the _prototype should't change, so in that logic it should throw an error, however, trying it in Chrome's console panel and node.js project it worked and s1 could invoke sayGoodbye . Can someone help me underst

What is the proper way to link a section on a page using locomotive scroll? [closed]

I have two section links on my page: home and about. Both of them do not work when you are below the respective sections. When the about link is clicked from the home section, it does scroll properly, but all of the content above is removed, other sections load in late and there is extra space at the bottom. This only goes back to normal when the home link is clicked. Actually, that is the only instance where the home link works. What am i doing wrong ? I will provide code to reproduce it if needed. Via Active questions tagged javascript - Stack Overflow https://ift.tt/HvpqlRn

Creating a Button with JavaScript

I'm currently learning JavaScript. I've been attempting to create a navbar button that opens the menu when clicked. After multiple attempts and changes to the code, I didn't solve the problem. HTML <nav class="nav"> <div class="logo">AdoptaPet</div> <button id="navBtn"><i class="bi bi-list abrirNav"></i></button> <ul id="abrirMenu" class="nav-links"> <i class="bi bi-x fecharNav"></i> <li><a href="">Home</a></li> <li><a href="">Sobre Nós</a></li> <li><a href="">Loja</a></li> <li><a href="">Cães para Adoção</a></li> <li><a href="">Detalhes do Cão</a&g

Create a regular expression to match big numbers

I get a response from the backend as text in which I have to find a match for numbers which is minimum 16 digits in length. Let's say I have data something like this: {"BIG_INT": 123456789012345675,"BIG_INT_ARRAY_SINGLE": [123456789012345676],"BIG_INT_ARRAY_MULTIPLE": [123456789012345661,12345678901234562,12345678901234563,12345678901234564],"STRING_BIG_INT_ARRAY": "[12345678901234567,12345678901234567, 12345678901234567,12345678901234567]","STRING_BIG_INT":"12345678901234567","BIG_INT_FLOATING_DECIMAL": 12345678901234567.76543210987654321} There are certain conditions where it should not match a number: If the number is enclosed within double quotes: ("STRING_BIG_INT":"12345678901234567" )` If the numbers are within string enclosed array: "STRING_BIG_INT_ARRAY":"[12345678901234567,12345678901234567]" If the number is fractional: "BIG_INT_FLOATING_D