I am using dbutils.widgets.dropdown in one notebook, XYZ.
dbutils.widgets.dropdown("user", "user1", Seq("user1", "user2"), "User Name")
user = dbutils.widgets.get("user")
However I would like to pass 'user' into another notebook, ABC as input string
Would like to know how to do ?
Thank you
Related
I am quite new to programming and currently self studying jupyter notebook for data analytics. I just need to know whether we can execute a data frame object inside and if else statement.
First I read city name from user and check whether the given city is in the data frame. And then filter the dataframe according to the value given by user. If city is not there, print that the city is not here. I need to know is there any method to execute this in a good way. This was my silly try. If someone can help, would be a big help
cityname = input("Input the name of the city to see the data required")
if totaldata['City'].any() == cityname:
totaldataCitywise = totaldata.loc[totaldata['City'] == cityname, :]
totaldataCitywise
else:
print('The city is not in the list')`
Using the borwser, I want to get back the names of workbooks that have upstream Flows. I think s something like below:
query fq {
workbooks(filter: {has: upstreamFlows})
{
name
upstreamFlows {
name
}
}
}
That gives me error Validation error of type WrongType: argument 'filter' with value 'ObjectValue{objectFields=[ObjectField{name='has', value=EnumValue{name='upstreamFlows'}}]}' contains a field not in 'Workbook_Filter': 'has' # 'workbooks'",
Looking for how to do it in the browser, am familiar with how to do it using api
Does Tableau's graphiql allow for filtering on missing/not missing ?
I am trying to generate fake email ID's for the purpose of research. I employ LazyAttribute towards this end. I want the email ID to correspond to the first and the last names of the person (generated using Faker). The function I wrote is below.
I am unable to get the expected output. If the name of the person is John Snow, I see the following as the output:
John Snow <factory.declarations.LazyAttribute object at ......
Can I expect some help to fix my code? Thanks!
def faker_categorical(num=1, seed=None):
np.random.seed(seed)
fake.seed_instance(seed)
output = []
for x in range(num):
gender = np.random.choice(["M", "F"], p=[0.5, 0.5])
output.append(
{
"First name": fake.first_name(),
"Last name": fake.last_name(),
"E-mail": factory.LazyAttribute(lambda obj: "%s#example.com" % obj.first_name),
})
return output
In the front end they are selecting multiple checkboxes i.e;(district,taluk)
,so how can i get the values to the backend and how to save in the database.
note: I want to write this code based on definition not generics
this is my models
class Example(models.Model):
district = models.CharField(max_length=20)
taluk = models.CharField(max_length=20)
if we give input in json format like
{
"Bangalore" :{
"dodballapura",
" Hosakote"
}
}
then it should save in database and
in the above example bangalore is the district and remaining are talukas
I'm using Red Gate SQL Data Generator 3. What I'm wanting to do is to generate test data where there are related fields in each row. For example, I want to generate a row of data that looks like this:
Username: CONTOSO\FFlintstone
FullName: Flintstone, Fred
Email: FFlintstone#contoso.com
Programatically, I'd want something like (pseudo-code):
Generate _lastname, _firstname
_username = first-letter of _firstname + _lastname
Fullname = _lastname + ", " + _firstname
Username = "CONTOSO\" + _username
Email = _username + "#contoso.com"
All the data generator samples I saw were for a single field, and didn't allow or consider needing to populate a row with related fields. I did not see a means of doing this within the product directly. Also, at the moment, the user forums at Red-Gate are down, so no help there.
Is this possible to do within the product? If so, could somebody post an example?
As a proof of concept, I created a dummy table with a primary key and some fields - firstname, surname, username and email.
firstname was just set to the generic "First Name" generator, as the surname was set to the "Last Name" generator.
I then used the "Simple Expression" generator for the username and email fields. The expression for the username generator was 'CONTOSO\\'+firstname[:1]+surname. For the email column, the expression I used was firstname[:1].lower()+surname.lower()+'#contoso.com'
This image shows the resulting data I managed to generate
I hope this helps.